Combobox Cascading need more specific cascadeFrom option

家住魔仙堡 提交于 2019-11-29 21:12:44

问题


I want to use the cascadeFrom feature of the Kendo UI ComboBox, but to my dismay it seems that that option will only accept an ID. Now I can't use the ID because the combobox is added dynamically and possibly multiple times resulting in multiple controls with the same ID.

Does anyone have any ideas on how I can either pass a specific dom object to the cascade or how I could possibly setup a custom cascade feature using the 'change' event?


回答1:


That cascading functionality is just some sugar to make it easier create cascading DropDowns/Combos.

Basically you need to use 4 things to manually implement yourself that fancy cascading-> change event of the parent ComboBox, enable method of the child ComboBox,value method of the parent ComboBox and the dataSource.read() method of the child ComboBox.

Initially the child is enabled(false) when the change event of the parent is triggered get the value of the parent and pass it to the read method of the child dataSource.read() method to send it to the server. Finally return the needed records from the server.

function OnChangeOfParentCombo(e){
     var child = $('#ChildCombo').data().kendoComboBox;
     child.enable(true);
     child.dataSource.read({myFilter:this.value()});
}


来源:https://stackoverflow.com/questions/13848264/combobox-cascading-need-more-specific-cascadefrom-option

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!