简体   繁体   中英

Kendo dropdownlist binding event inside grid client template

Am trying to add a dropdown inside the kendo grid. And I need to add it inside the clienttemplate instead of editortemplates as i need the whole grid to be in edit mode on loading itself.

And this is the way i did it.

.ClientTemplate("<input class='pUomDdl' #= UOMCodeEnabled ? disabled='disabled' : '' # value='#= UOMCode #' data-uomCode='#= UOMCode #' data-role='dropdownlist' data-source='UOMList' data-text-field='Text' data-value-field='Value' change='onUOMchange'/>");

Now my problem is the change event is not at all getting invoked. Dropdown is asking me for the event but when i add it to script tag it's not at all getting called.

Any clue??

Finally I got a work around in this way with the databound event of the kendo grid.

Problem is with the dropdown getting loaded after the grid gets loaded. the binding happening before the code gets initiated itself.

So the workaround is to bind the dropdown to the concerned event only afte it gets initiated. Means we must do something inside the databound event of the grid.

var grid = $("#myGrid").data("kendoGrid");      
grid.table.on("change", ".k-dropdown .pUomDdl" , onuomchange);   

Hope it might help somebody who want to have a kendo grid with the dropdowns, textboxes, datepickers etc within the clienttemplate itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM