Open nilesjohnson opened 9 years ago
An idea: load the relevant data (modify the loadCountries function in the controller) and put it in a javascript object. Add/modify the custom 'matcher' and 'sortResults' functions to pull from that data (set an id for each select element, and use this in javascript to find the relevant data).
I see two options:
We have a custom sorter for select2 already, and it is working for tags, but is partly broken for countries.
Matches are correctly sorted within categories, but not across categories. For example, type 'zi' and see that Zimbabwe is listed above Swaziland. But Brazil is in a different category, below Swaziland.
note: removing the grouping by region would solve the sorting problem.
Leftover enhancement idea from #19 : Two ideas from that article that are not implemented:
I had trouble getting cake's form helper to output additional custom attributes in the select field (as in, I looked, and there was no functionality for this in the documentation). And attempting to add the relevant fields by hand, without the form helper, caused trouble with the CSRF token. Probably the fields weren't encoded in the token properly (or at all).