具有客户端过滤功能的级联剑道下拉列表

Cascade kendo Dropdownlist with client side filtering

提问人:Anastasios Selmani 提问时间:10/19/2017 最后编辑:Anastasios Selmani 更新时间:10/20/2017 访问量:1573

问:

我想知道是否有任何方法可以使 Cascade kendo DropDownList(绑定到远程数据)具有客户端过滤功能。我知道我可以只使用主下拉列表的 change 事件来获得级联效果并处理这种情况,但我想知道是否有一种“剑道”方式来处理这种情况。可能是我可以设置的一些参数,但我忽略了。

kendo-asp.net-mvc 客户端 kendo-dropdown

评论


答:

2赞 AlameerAshraf 10/20/2017 #1

我认为这个例子会有所帮助:

category: <input id="category" />
product: <input id="product" />
var category = $("#category").kendoDropDownList({
    optionLabel: "Select category...",
    dataSource: [
        { CategoryID: 1, CategoryName: "Beverages" },
        { CategoryID: 2, CategoryName: "Condiments" },
        { CategoryID: 3, CategoryName: "Confections" }
    ],
    dataValueField: "CategoryID",
    dataTextField: "CategoryName"
}).data("kendoDropDownList");

var product = $("#product").kendoDropDownList({
    optionLabel: "Select product...",
    dataSource: [
        {"ProductID":35,"ProductName":"Steeleye Stout","CategoryID":1},
        {"ProductID":3,"ProductName":"Aniseed Syrup","CategoryID":2},
        {"ProductID":4,"ProductName":"Chef Anton's Cajun Seasoning","CategoryID":2},
        {"ProductID":5,"ProductName":"Chef Anton's Gumbo Mix","CategoryID":2},
        {"ProductID":6,"ProductName":"Grandma's Boysenberry Spread","CategoryID":2},
        {"ProductID":8,"ProductName":"Northwoods Cranberry Sauce","CategoryID":2},
        {"ProductID":16,"ProductName":"Pavlova","CategoryID":3},
        {"ProductID":19,"ProductName":"Teatime Chocolate Biscuits","CategoryID":3},
        {"ProductID":20,"ProductName":"Sir Rodney's Marmalade","CategoryID":3},
        {"ProductID":21,"ProductName":"Sir Rodney's Scones","CategoryID":3},
        {"ProductID":25,"ProductName":"NuNuCa Nuß-Nougat-Creme","CategoryID":3}                
    ],
    dataValueField: "ProductID",
    dataTextField: "ProductName",
    cascadeFrom: "category"
}).data("kendoDropDownList");

评论

0赞 Anastasios Selmani 10/20/2017
我可能应该提到我的 dataSource 绑定到远程数据。我使用级联功能,因为我的 dataSource 有几百个项目,我无法从一开始就加载它们(全部)。