简体   繁体   English

网格客户端模板中的Kendo dropdownlist绑定事件

[英]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. 我需要将其添加到clienttemplate而不是editortemplates内,因为我需要整个网格在加载自身时处于编辑模式。

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. 最终,我以这种方式解决了Kendo网格的数据绑定事件。

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. 希望它对希望在客户端模板本身中具有下拉菜单,文本框,日期选择器等的剑道网格的人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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