刷新kendo dropdownlist在事件更改另一个档案列表之后



当我从第一个DDL更改值时,我会从其他DDL的Ajax获取数据,但并未刷新。

这是我的网格

$("#grid").kendoGrid({
        dataSource: 
height: 500,
                toolbar: ["create"],
                columns: [
                     { command: ["edit"], title: " ", width: "150px", locked: true },
                    { field: "RowLabels", title: "Row Labels", width: "180px", locked: true },
                    { field: "IdValueStream", title: "VS", width: "90px", locked: true, editor: vsDropDownEditor, template: "#=getVsName(IdValueStream)#" }, //, template: "#=IdValueStream.ValueStream#"
                    { field: "IdLine", title: "Line", width: "180px", locked: true, editor: linesDropDownEditor }, //, template: "#=getLineName(IdLine)#" 
                       { field: "W1", title: Weeks[0].W1.substring(0, 10), width: "98px" }, // 
                       { field: "W2", title: Weeks[0].W2.substring(0, 10), width: "90px" },
                       { field: "W3", title: Weeks[0].W3.substring(0, 10), width: "90px" },
                       { field: "W4", title: Weeks[0].W4.substring(0, 10), width: "90px" },
                       { field: "W5", title: Weeks[0].W5.substring(0, 10), width: "90px" },
                       { field: "W6", title: Weeks[0].W6.substring(0, 10), width: "90px" },
                       { field: "W7", title: Weeks[0].W7.substring(0, 10), width: "90px" },
                       { field: "W8", title: Weeks[0].W8.substring(0, 10), width: "90px" },
                       { field: "W9", title: Weeks[0].W9.substring(0, 10), width: "90px" },
                       { field: "W10", title: Weeks[0].W10.substring(0, 10), width: "90px" },
                       { field: "W11", title: Weeks[0].W11.substring(0, 10), width: "90px" },
                       { field: "W12", title: Weeks[0].W12.substring(0, 10), width: "90px" },
                       { field: "W13", title: Weeks[0].W13.substring(0, 10), width: "90px" }
                ],
                editable: "inline"
            });

这是第一个DDL

的编辑器的方法
function vsDropDownEditor(container, options) {
    $('<input id="ddlVs" data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoDropDownList({
                    dataTextField: "ValueStream",
                    dataValueField: "Id",
                    dataSource: categories,
                    select: onSelect
                });
}

这是第二个DDL

编辑器的另一种方法
function linesDropDownEditor(container, options) {
    $('<input data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoDropDownList({
                    autoBind: false,
                    dataTextField: "Line",
                    dataValueField: "Id",
                    dataSource: lines
                });
}

因此,当我选择第一个DDL的项目时,我想刷新第二个DDL

在第二个下拉列表中放置一个 id属性,然后在 ddVsonSelect函数中添加此行的代码。

$("#nameOfYourSecondDropdownHere").data('kendoDropDownList').dataSource.read();

您也可以检查以下示例 - 级联下拉列表在网格中用作编辑器:

添加级联下拉列表编辑器

最新更新