Bug in select2 advanced when adding custom class name to container?
- This topic has 2 replies, 2 voices, and was last updated 2 years ago by
Aishwarya.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
March 8, 2024 at 5:36 PM #44772
Aishwarya
ParticipantI am populating a select2 advanced field using the below code but it just shows normal select instead of select2 with search box. When removing the "containerCssClass", it works.
array( 'name' => 'Select Language', 'id' => 'language', 'type' => 'select_advanced', 'ajax' => true, 'options' => [ 'java' => 'Java', 'javascript' => 'JavaScript', 'php' => 'PHP', 'kotlin' => 'Kotlin', 'swift' => 'Swift', 'javha' => 'Java', 'javhascript' => 'JavaScript', 'pfhp' => 'PHP', 'kottlin' => 'Kotlin', 'swiyjft' => 'Swift', ], 'placeholder' => 'Select an Item', 'js_options' => [ 'containerCssClass' => 'my-custom-class', ], ),this works
array( 'name' => 'Select Language', 'id' => 'language', 'type' => 'select_advanced', 'ajax' => true, 'options' => [ 'java' => 'Java', 'javascript' => 'JavaScript', 'php' => 'PHP', 'kotlin' => 'Kotlin', 'swift' => 'Swift', 'javha' => 'Java', 'javhascript' => 'JavaScript', 'pfhp' => 'PHP', 'kottlin' => 'Kotlin', 'swiyjft' => 'Swift', ], 'placeholder' => 'Select an Item', ),March 8, 2024 at 9:53 PM #44774Peter
ModeratorHello,
There isn't an option
containerCssClassin the Select2 documentation https://select2.org/configuration/options-apiPlease correct option name and check this issue again.
March 11, 2024 at 6:27 PM #44796Aishwarya
ParticipantHi Peter,
Thanks for the clarification.
I got it. I didn't compared it with select2.org options but just copied it from metabox documentation https://docs.metabox.io/fields/select-advanced/
Anyway, I will check it out by changing the option name.
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.