Kendo Refresh(DropDownList.refresh())无效ERROR未定义
我试图在另一个DropDownList更改后刷新下拉列表但是Refresh()方法是Undefined Error IsInding.There For I Tried Read the DataSource再次显示它正在加载但是数据仍然是相同的。帮助解决请问这个问题。
码:
$("#DropDownList1").change(function () { custCode = $("#DropDownList1").val(); $("#titles").data("kendoDropDownList").dataSource.read(); //shows list Loading But Same Data Is present . $("#titles").data("kendoDropDownList").refresh(); //NOT Working });
1-尝试添加cache: false
以禁用Kendo DropDownList的数据源读取属性中的缓存:
read: { url: <<"url">>, cache: false }
2-然后调用read()
,
$("#ddl").data("kendoDropDownList").dataSource.read();
它对我有用:)
对我来说,这条线完成了这项工作:
$("#myDropDownList").data("kendoDropDownList").dataSource.read();
您可能会发现将参数传递给dataSource的“.data()”非常有用。
例:
var myDataSource={bookId: 10, Name: "Kendo"} $("#titles").data("kendoDropDownList").dataSource.data(myDataSource);
但是,当您想根据另一个DropDownList的选择更新一个DropDownList时,您还可以尝试DropDownList的cascadingFrom属性。
//霍迪尼
在你的阅读url上添加’?myDate =’+ new Date()。 这将刷新数据。 没有它(除非你有meta标签来防止缓存)它会给你已经读过的数据。
在我的情况下,我评论了这条线
//cascadeFrom: "dropdown1_id"
在第二个剑道下拉列表,它工作,由于某种原因,它是在搞乱数据源更新。