wordpress-fieldmanager
wordpress-fieldmanager copied to clipboard
Select / Chosen type_ahead incompatible with Term datasource
In our Post's term fields, we want to persist the assigned order so the first term assigned to a Post can be considered the "primary" term. Fieldmanager's Select Field with type_ahead
and the term data source only works part of the way for this.
Using Chosen, I can assign terms to a post in arbitrary order. The terms are saved to the database correctly. However, because the <select>
is built with <option>
taxonomy terms in alphabetical order, my specified order is ignored for display (and lost when I save the post).
But, I think the bug is that use_ajax
doesn't work with Chosen. For my term data source, I don't want to load all of the terms at once because it's a performance issue.
Apparently this is why Select2 exists: https://github.com/harvesthq/chosen/issues/79#issuecomment-4312427
Autocomplete isn't an option because the UI for supporting multiple values isn't that great.
@mboynes @netaustin how would you guys feel about incorporating https://github.com/meltingice/ajax-chosen ?
Core is going to start using Select2 in places, so it might be better to use that for consistency (unless there's a really good reason to not use it). Regardless, I'm game for changing this.
so it might be better to use that for consistency (unless there's a really good reason to not use it)
Heh. If you think TinyMCE is bad...
There is a Chosen implementation in FM Select that was added by me probably close to 2 years ago for a rather specific purpose and fell into disuse. No one that I know is still using it in its current form.
I'd suggest potentially replacing that with this.
Needed to get something together for Fusion, so I put together a Select2 field: https://gist.github.com/danielbachhuber/1293ce788c2398ef6cf5
If you don't mind being bound to a particular library, a dedicated field type for Select2 might make the most sense.
This is still an issue where the order isgetting changed in chosen field. Are there any plans to fix this issue?