[英]Refresh Kendo dropdownlist after event change of another 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
屬性,然后在ddVs
onSelect
函數中添加此行代碼。
$("#nameOfYourSecondDropdownHere").data('kendoDropDownList').dataSource.read();
您還可以查看以下示例-在Grid中用作編輯器的級聯DropDownLists:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.