Open ericandrewlewis opened 10 years ago
Backing up to think through the goals of the wrapper. Interested in any thoughts on other goals that may be missing, or things that shouldn't affect design decisions.
So, with that, I think we do need something more generic. It may be that the wrapper in its basic form only supports the basics, although we should consider that essentially all of the currently noted potential usages in core will include Ajax.
I've made the wrapper more generic, so now it will support a <select>
with preloaded options, but doesn't give you access to the AJAX layer.
Also of note: Select2 doesn't support mixing preloaded content with AJAX-loaded data out of the box.
I'm curious how generic others think this wrapper should be.
Select2 has a rather specific API regarding AJAX endpoints and the data expected by them. Presumably similar libraries have their own opinionated internals which may differ, so exposing a generic Select2 wrapper doesn't sound like a good option to me. Rather, a one-off per use case - here, offering $().wpUsersDropdown().