Skip to content

Instantly share code, notes, and snippets.

@kennethdavidbuck
Created September 29, 2013 16:38
Show Gist options
  • Save kennethdavidbuck/6754104 to your computer and use it in GitHub Desktop.
Save kennethdavidbuck/6754104 to your computer and use it in GitHub Desktop.
Example use of select2 with EmberJS.
{{view App.Select2View
class="table-combobox"
prompt="-- Related Database Tables"
contentBinding="table.paceTables"
optionLabelPath="content.label"}}
App.Select2View = Em.Select.extend({
_setup:function(){
"use strict";
var placeholder = this.get('prompt');
this.$().select2({
//placeholder:placeholder//,
//minimumInputLength:2
});
}.on('didInsertElement'),
_tearDown:function(){
"use strict";
this.$().select('destroy');
}.on('willDestroyElement'),
change:function(){
"use strict";
this._super();
this.get('controller').send('select',this.get('selection'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment