Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo dropdownlist trigger change event

I am trying to set the value of my Kendo dropdownList using the code below and expecting the "Change" event to be raise but it doesn't. Can someone please help.

Added additional Code as requested.

HTML Code

<div class="col-md-12 no-padding">
     <select id="serviceAccounts"
             kendo-drop-down-list
             k-ng-model="vm.customer.serviceAccountId"
             k-value-primitive="true"
             k-options="vm.setServiceAccountOptions" style="width: 100%">
     </select>
</div>

Thanks in Advance !

like image 782
tt0206 Avatar asked Nov 07 '16 22:11

tt0206


1 Answers

$("#serviceAccounts").trigger("change");

Does not trigger the "change" event of the Kendo DropDownList because

$("#serviceAccounts")

Is not your Kendo DropDownList...it is just a jQuery selector.

You need to get a reference to the actual DropDownList before you can trigger one of its events, i.e.:

var dropDownList = $("#serviceAccounts").getKendoDropDownList();
dropDownList.trigger("change");

Example showing difference between selector.trigger() and dropdownlist.trigger(): http://dojo.telerik.com/@Stephen/UxiLo

Example showing how to trigger the change event using angular widget reference instead of jQuery widget reference: http://dojo.telerik.com/@Stephen/IToFI

like image 177
The Dread Pirate Stephen Avatar answered Nov 06 '22 15:11

The Dread Pirate Stephen