Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex Group - Select2 dropdowns lose function after dragging complex group #1264

Open
henrik-dons opened this issue Nov 11, 2024 · 0 comments

Comments

@henrik-dons
Copy link

henrik-dons commented Nov 11, 2024

Version

  • Carbon Fields: 3.6.5
  • WordPress: 6.6.2
  • PHP: 8.2

Expected Behavior

Select2 in complex group remains select2

Actual Behavior

Select2 in complex group reverts back to regular select field

Container definition

// Please add your entire container defintion here so issues
// are easy to reproduce

Field::make( 'complex', 'cb_complex_group', 'Groups' )
    ->add_fields( array(
        Field::make( 'select', 'cb_group_select', 'Select group' )
            ->set_classes( 'select2' )
            ->set_options( array(
                'one' => 'Option 1',
                'two' => 'Option 2',
            ))
));

// admin.js: jQuery('.select2').select2();

Steps to Reproduce the Problem

  1. Locate the field group
  2. Add 2 complex groups
  3. Switch order of the complex group

Comments

I have managed to re-initialize the Select2 when new complex groups get added to the list
Is there also a hook to trigger when a complex group has been dropped again?
Then I could re-initialize the select2 again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant