Created
September 24, 2013 16:19
-
-
Save lifeinafolder/6687255 to your computer and use it in GitHub Desktop.
An Ember wrapper for chosen multi-select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= 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