While messing around in DevTools trying to see how DropdownFields are built, I found out a hidden part with CSS class chzn-search. When I revealed it, a nice filtering div appeared, fully functional. Something I would like to deliver on the admin side. How can I turn it on in the DropdownField declaration? I can't seem to find a field subclass that would turn it on.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
I'm not sure this is what you found however uncle cheese has a nice tutorial on how to have a dropdown with search amongst other nice field types. Check it out at: http://www.leftandmain.com/?s=bootstrap&cat=4&link=1
If it's the searchbox within the dropdown you're referring to, it should appear if the number of options exceeds 20, as that is how selectboxes in the cms are instantiated by default (using the 'chosen' library). See LeftAndMain.js #46 : disable_search_threshold: 20
https://github.com/silverstripe/silverstripe-framework/blob/3.1/admin/javascript/LeftAndMain.js
True, when the search panel did appear when I increased the amount of records. Thanks for that.
The filter however appears to use "starts with" filtering. Is there a way to change it to "contains" mode?
Oh wait! It does the "contains" search, but only among original values, as long as the are not altered by custom function (I'm using DropdownSummary to return customized label)