Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

formatChoice #471

wants to merge 2 commits into


None yet
3 participants

I've added the ability to overwrite the standard result format and apply special processing. Nice additions to this plugin BTW, it's been great getting integrated today and a sweet compliment to my Backbone.js project.


ivaynberg commented Oct 5, 2012

what would this be useful for? formatSelection already allows you to fill in the inside. the li and the anchor inside the li are expected by other code.

plus when you overwrite it you have to add the correct css classes otherwise stuff will break, which requires internal knowledge of select2. eg those classes may change in a future release.

You can't add any style to the LI. I need to be able to have each LI behave differently depending on the selection I choose. formatChoiceCSS would also solve that problem, but I can see people wanting to use other templates in their selection display as well.

I also added some triggers for addChoice and removeChoice. I am using this not for tags but for a pretty complex select and with some hacks it's working well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment