组合框级联需要更多特定的层叠自选项 [英] Combobox Cascading need more specific cascadeFrom option

查看:69
本文介绍了组合框级联需要更多特定的层叠自选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Kendo UI ComboBox的CascadeFrom功能,但令我沮丧的是,该选项似乎只接受一个I​​D.现在我无法使用ID,因为组合框是动态添加的,并且可能会多次添加,从而导致多个具有相同ID的控件.

有人对我如何将特定的dom对象传递到级联或如何使用'change'事件设置自定义级联功能有任何想法吗?

解决方案

级联功能只是为了使创建级联DropDowns/Combos更容易而已.

基本上,您需要使用4件事来手动实现自己喜欢的级联-> 更改父组合框的事件 启用 子ComboBox的方法, 父级ComboBox的方法和 dataSource.read()方法ComboBox的孩子.

最初,当触发父级的change事件时,将启用子级(false),以获取父级的值,并将其传递给子级dataSource.read()方法的read方法,以将其发送到服务器.最后从服务器返回所需的记录.

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

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?

解决方案

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()});
}

这篇关于组合框级联需要更多特定的层叠自选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆