Select Advanced field not showing as an Admin Column

Support MB Admin Columns Select Advanced field not showing as an Admin ColumnResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31280
    MartinMartin
    Participant

    I have a Select Advanced field which I want to show as an Admin column. It won't appear for me (although it was fine under an older version of MB).

    I've tried showing other field types (such as a radio) from the same field group against my CPT and it shows fine.

    Is Select Advanced just not compatible with Admin Columns or is there something additional I should be doing for it to display?

    #31285
    Long NguyenLong Nguyen
    Moderator

    Hi Martin,

    The field select_advanced works as well with the extension MB Admin Columns. I also do not see that on my demo site. Can you please share the code that creates the fields?

    For example, this sample field shows the value in the admin column

    function your_prefix_function_name( $meta_boxes ) {
        $meta_boxes[] = [
            'title'  => __( 'Post Meta', 'your-text-domain' ),
            'id'     => 'post-meta',
            'fields' => [
                [
                    'name'          => __( 'Select Advanced', 'your-text-domain' ),
                    'id'            => $prefix . 'select_advanced',
                    'type'          => 'select_advanced',
                    'options'       => [
                        'a' => __( 'A', 'your-text-domain' ),
                        'b' => __( 'B', 'your-text-domain' ),
                        'c' => __( 'C', 'your-text-domain' ),
                    ],
                    'multiple'      => true,
                    'admin_columns' => 'after title',
                ],
            ],
        ];
        return $meta_boxes;
    }
    #31288
    MartinMartin
    Participant

    I see what the problem is - it's not generating the code from the builder for the field.

    My code is generated as:

                [
                    'name'    => __( 'Job Status', 'your-text-domain' ),
                    'id'      => $prefix . 'job_status',
                    'type'    => 'select_advanced',
                    'options' => [
                        'Active'          => __( 'Active', 'your-text-domain' ),
                        'Not Going Ahead' => __( 'Not Going Ahead', 'your-text-domain' ),
                        'Completed'       => __( 'Completed', 'your-text-domain' ),
                        'Cancelled'       => __( 'Cancelled', 'your-text-domain' ),
                    ],
                    'std'     => 'Active',
                ],
    

    It does, however, still save the settings against the field in the builder.

    #31301
    Long NguyenLong Nguyen
    Moderator

    Hi,

    If you use the Builder to create the field, please add the column name to the Column Position box. Screenshot https://imgur.com/PD4TBbm

    Note: the admin column does not show the sub-field value in a group.

    #31379
    MartinMartin
    Participant

    It looks like there was a bug somewhere in the field generation code. I tried a number of the other fields in the form and they were all fine as an admin column. I also tried changing the field type of the one that wasn't working and it still wouldn't appear. I then created a new field using the same ID (having changed the ID of the non-working one) using all the same settings and it worked fine. All I can conclude is that there was some error behind the scenes but it is working fine now so all good.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.