ember-select-2 icon indicating copy to clipboard operation
ember-select-2 copied to clipboard

mouse events on select2

Open BenjaminHorn opened this issue 10 years ago • 2 comments

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 avatar May 21 '15 14:05 BenjaminHorn

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);
        },

cemarte avatar Jul 28 '15 14:07 cemarte

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

jayeshkb avatar Oct 21 '15 03:10 jayeshkb