Page 1 of 1

how to use data-on-item-select

Posted: Sat Apr 20, 2019 9:37 pm
by elpepefontana
Im trying to add behavior to a data-role="select", but i cant make the event data-on-item-deselect to run.

<select data-role="select" data-on-item-deselect="alert('try');">
........
</select>

I have tried to put the events in <option>, not working either.

I can use the "data-on-change" event ok, but "data-on-item-deselect" and "data-on-item-select" are not working?
I want to save "select".val() on a hidden field on "data-on-item-select" an to erase it with "data-on-item-deselect".

How can i make it work?

Re: how to use data-on-item-select

Posted: Sat Apr 20, 2019 9:38 pm
by olton
This work with select with attribute multiple

Re: how to use data-on-item-select

Posted: Sat Apr 20, 2019 11:08 pm
by elpepefontana
I'm using it with a "multiple" select.
this is the code:

<select id="slt_3" name="slt_3" class="" data-role="select" multiple data-cls-option="fg-gray" data-on-change="setLevelSelect(3)" data-on-item-deselect="alert('try');">
</select>

Re: how to use data-on-item-select

Posted: Sat Apr 20, 2019 11:48 pm
by olton

Re: how to use data-on-item-select

Posted: Sun Apr 21, 2019 1:15 am
by elpepefontana
Can't make it work....
It's a dinamic generated select, but all attributes are ok.
Will it be a difference if the select content is generated dinamically?
I'm doing its like this:
loop ------

var select = $('#slt_' + n).data('select');
select.data(out)

----- loop

The values Show OK.

Re: how to use data-on-item-select

Posted: Sun Apr 21, 2019 1:18 am
by olton
Create your code example on codepen.io or sandbox.org.ua