domingo, 14 de mayo de 2017

Chosen Jquery with dynamically load

Recently my boss ask me change the select2 plugin for the chosen plugin for jquery in order to use only the libraries that the entire department had approved previously. As you know, chosen plugin does not have an option for remote data. That does not mean that we cannot use remote sources with chosen, in fact, we can but with some "tricks", I mean, there's no so complicated but I did not find any answer in stackoverflow that convinced me very well.

So, this the explanation about how I achieved the chosen plugin into chosen remote plugin.

1. Understand the debounce concept
2. Program an ajax call
3. Format results
4. Clean chosen select
5. Update select.

Well, the code is here