⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Search containing string in chosen / multiple select dropdown list



DerRobert

DerRobert
  • profile picture
  • Member

Posted 11 January 2018 - 10:04 AM

Hi to all,

 

I have created a n_n relation and the jquery chosen plugin works very fine. I just experienced that when using the search field of the dropdown I only can search strings that start with the provided search string, but nothing that also contains the search string.

 

Is there a way to change this behaviour or is this a limitation of chosen.js ?

 

Thanks to all!

-Rob


jmcastro2004

jmcastro2004
  • profile picture
  • Member

Posted 23 July 2020 - 21:33 PM

Set search_contains: true into

/assets/grocery_crud/js/jquery_plugins/config/jquery.chosen.config.js

 

$(function(){
    $(".chosen-select,.chosen-multiple-select").chosen({allow_single_deselect:true});
});

 

to

 

$(function(){
    $(".chosen-select,.chosen-multiple-select").chosen({allow_single_deselect:true, search_contains: true});    
});


emmajoe

emmajoe
  • profile picture
  • Member

Posted 15 October 2020 - 01:47 AM

A search box is added to the top of the dropdown automatically for select boxes where only a single option can be selected. The behavior and appearance of the search box can be easily customized with Select2. You can try it. word to pdf