Open ChangePlaces opened 4 years ago
The id and text names are a select2 requirement. https://select2.org/data-sources/formats
There is no way to change it for now but I think it would be possible to enhance the templating functionality to provide a simple means to use a different property name. I can't make any promises but I agree that it would probably be a useful feature.
with select2 v.3 you could override the selection method and return the property you want to use. in 3 it was formatSelection and formatResults iirc. It looks like they've been renamed to templateSelection and TemplateResults for 4.*.
https://stackoverflow.com/questions/23643409/in-select2-how-do-formatselection-and-formatresult-work
I see 'text' is required in the AJAX response to show. How can I change this to a different value from 'text', to 'foo'? Maybe it could be a property on the form type?