ember-select-2
ember-select-2 copied to clipboard
mouse events on select2
I try to use some mouse events on select2. Since the component's original element is hidden somewhere deep under the markup - which built up by the jquery plugin - the following code:
controller.js
someFunction: function(){
console.log('select is clicked');
}
.hbs
{{ select-2 content=model click=someFunction}}
has no effect.
I also tried to extend the component and target this._select, but it looks like it is the same element as this.$(), which -again-, is hidden under select2
BenjaminHorn
I've been though the same problem and found this:
https://github.com/iStefo/ember-select-2/blob/master/tests/unit/components/select-2-test.js#L170
Define the handler to didSelect event:
{{select-2
value=controlValue
content = controlContent
placeholder='Something...'
didSelect= 'selectionChanged'
}}
And the controller code:
selectionChanged: function(selection, context) {
console.log(selection);
},
I downloaded latest 3.5.4 and tried didSelect hook but my controller function selectionChanged did not get called on enter nor on mouse click. Could you please help me here? Thanks!
-Jay