Skip to content

Instantly share code, notes, and snippets.

@lifeinafolder
Created September 24, 2013 16:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lifeinafolder/6687255 to your computer and use it in GitHub Desktop.
Save lifeinafolder/6687255 to your computer and use it in GitHub Desktop.
An Ember wrapper for chosen multi-select
//= require chosen-jquery
UiControls = window.UiControls || Ember.Namespace.create();
/**
* Custom Multi-Select enabled with 'chosen'
* @class
* @memberOf UiControls
* @extends Ember.Select
*
* @example
* {{view UiControls.MultipleSelect contentBinding="<Ember.ArrayController>" optionValuePath="content.value" optionLabelPath="content.
* label" selectionBinding="Ember.Array"}}
*
*/
UiControls.MultipleSelect = Em.Select.extend({
multiple: true,
classNames: ['uicontrol-multiple-select'],
attributeBindings: [ 'multiple' ],
didInsertElement: function() {
this._super();
this.$().chosen();
},
selectionChanged: function() {
this.$().trigger('liszt:updated');
}.observes('selection')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment