You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this plugin is awesome, but i think would be better if offers the possibility to have a dataSource or something like that, why?, keep reading :D...
I'm working on a project using this plugin, but in some cases, i need execute some function on select event, the problem is when that function needs a field of the object represented in the options list, for example, in my project, the ajax request return a client list, where the client's id is the 'value' and the client's name is the 'text' shown on the options list of the plugin, i need execute a function for validate or show something using/depending of another field of the client, like status or email (any field can be used), but i can't access to these fields.
My proposal is add a 'item' parameter on the json returned in the ajax request, and that field contains the complete object (or extra fields if the object have too many fields and not all of them are needed on the client-side) represented in the ajax request, and add a method like getItem(), which return the item selected instead of the value as the "val()" method does.
Twitter Typeahead plugin have a event ('typeahead:selected') which is fired when the user select an item, and the function of this event has two parameters, the event himself and the item with the object. Would be nice have something like that here....
So anything that happens after the options are generated are handled by bootstrap-select not this plugin. Once we generate the options are hands are off for any select, click, etc... events. We don't have any control over the return value on select.
As for your last sentence:
onOpen - bootstrap-select would need to implement this
onClose - bootstrap-select would need to implement this
onSelect - bootstrap-select would need to implement this
afterRequest - preprocessData option is called immediately after any ajax request. The first parameter is the raw data from your server and you should return the json in the way the plugin expects (like you have above).
For beforeReqeuest we don't have a specific option or even for that, but assuming you are trying to manipulate you could use the ajax options with data being a function. This is something we added so that the data sent to the server could be generated dynamically. The only caveat is that whatever key you want to have the value typed in the search box needs to have a value of {{{q}}}. We have an example of this in the usage example at the bottom of the read me.
Hi, this plugin is awesome, but i think would be better if offers the possibility to have a dataSource or something like that, why?, keep reading :D...
I'm working on a project using this plugin, but in some cases, i need execute some function on select event, the problem is when that function needs a field of the object represented in the options list, for example, in my project, the ajax request return a client list, where the client's id is the 'value' and the client's name is the 'text' shown on the options list of the plugin, i need execute a function for validate or show something using/depending of another field of the client, like status or email (any field can be used), but i can't access to these fields.
My proposal is add a 'item' parameter on the json returned in the ajax request, and that field contains the complete object (or extra fields if the object have too many fields and not all of them are needed on the client-side) represented in the ajax request, and add a method like getItem(), which return the item selected instead of the value as the "val()" method does.
Twitter Typeahead plugin have a event ('typeahead:selected') which is fired when the user select an item, and the function of this event has two parameters, the event himself and the item with the object. Would be nice have something like that here....
this is my json proposal:
Would be nice too, have events like onOpen, onClose, onSelect, beforeRequest, afterRequest, etc 👍
The text was updated successfully, but these errors were encountered: