'default_state' => 'collapsed', not collapsing group on load

Support MB Group 'default_state' => 'collapsed', not collapsing group on loadResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9969
    makeagencymakeagency
    Participant

    The group remains open after initial page load.

    I have the follwing metabox extensions installed:

    MB Admin Columns
    MB Revision
    MB Term Meta
    MB Group
    MB Conditional Logic
    MB Include Exclude
    MB Show Hide
    Meta Box Updater

    $meta_boxes[] = array(
        'id'         => 'C_hotel_previews', 
        'title'      => '<img src="'.get_template_directory_uri().'/assets/metabox/img/cpt-hotel-preview.png">',
        'post_types' => array( 'hotels' ),
        'autosave'   => false,
        'context'    => 'normal',
        'priority'   => 'high',
        'fields'     => array(
            array(
                'name' => 'Hotel Previews',
                'type' => "heading",
                'desc' => 'Add an area and include it\'s corresponding images with descriptions.',
            ),
            // GROUP
            array(
                'id'     => 'hotel_area_group',
                'type'   => 'group',
                'clone'  => true,
                'sort_clone' => true,
                'collapsible' => true,
                'default_state' => 'collapsed',
                'group_title' => array( 'field' => "{$prefix}area_title" ),
                'add_button' => '+ Area',
                'fields' => array(
                    // TEXT
                    array(
                        'name' => 'Area Title',
                        'id' => "{$prefix}area_title",
                        'type' => 'text',
                        'label_description' => 'Rooms, Swimming Pool, Restaurant, etc...',
                    ),
                    // GROUP
                    array(
                        'id'     => 'slide_group',
                        'type'   => 'group',
                        'clone'  => true,
                        'sort_clone' => true,
                        'collapsible' => true,
                        'default_state' => 'collapsed',
                        'save_state'  => true,
                        'group_title' => 'Slide {#}',
                        'add_button' => '+ Slide',
                        'fields' => array(
                            // IMAGE
                            array(
                                'name'             => 'Image',
                                'id'               => "{$prefix}slide_group_image",
                                'type'             => 'image_advanced',
                                'force_delete'     => false,
                                'max_file_uploads' => 1,
                                'max_status'       => true,
                            ),
                            // WYSIWYG/RICH TEXT EDITOR
                            array(
                                'name' => 'Description',
                                'id'   => "{$prefix}slide_group_wysiwyg",
                                'type' => 'wysiwyg',
                                'raw'  => false,
                                'options' => array(
                                    'textarea_rows' => 3,
                                    'teeny'         => true,
                                    'media_buttons' => false,
                                ),
                            ),
                        ),
                    ), // end Group
                ),
            ), // end Group 
        ),
     );
    #10059
    Anh TranAnh Tran
    Keymaster

    Hello, I've just tried your code and it works. Did you see any error in the console?

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