组合框级联需要更具体的级联选项 [英] Combobox Cascading need more specific cascadeFrom option

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

问题描述

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

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.

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

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?

推荐答案

级联功能只是为了更轻松地创建级联 DropDowns/Combos.

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

基本上你需要使用 4 件事来手动实现自己的花式级联-> change 父组合框的事件,启用子ComboBox的方法,value 父 ComboBox 方法和 dataSource.read() 方法的子组合框.

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.

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

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天全站免登陆