If you are writing a web app, you may or may not know about the Select2 control found HERE. I posted about it a few months ago here: http://www.eddiedillon.info/?p=348 and I was going to give you an update with an example of how to use it with an underscore template to create a searchable select with grouping. This will be useful in a project I am working on and I thought I would share. I have attached my jsFiddle below, the creator has an example of templating you can find there but I couldn’t really find an example of how to load the data in dynamically and you CANNOT use the ajax function in it with a select, so basically I create the entire select up front then style it.
Create a dynamic and searchable optgroup with select2
January 16th, 2013 by admin Leave a reply »
Advertisement