1
我有一个Kendo DropDownList,我想通过javascript函数更新/刷新。使用FireFox和Chrome,它工作正常,但与Internet Explorer,它不会更新任何东西。使用Internet Explorer更新Kendo DropDownList
@(Html.Kendo().DropDownList()
.Name("myDDL")
.HtmlAttributes(new { style = "width: 320px" })
.DataTextField("Description")
.DataValueField("Id")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("fillDDL", "ControllerName");
});
})
)
JavaScript函数:
function refreshForm() {
$("#myDDL").data("kendoDropDownList").dataSource.read();
}
而且还检查this question,但没有运气。
我使用Internet Explorer 11进行测试。
任何帮助?
编辑
这是生成的Javascript代码:
jQuery(function() {
jQuery("#myDDL").kendoDropDownList({
"dataSource": {
"transport": {
"read": {
"url": "/ControllerName/fillDDL"
},
"prefix": ""
},
"schema": {
"errors": "Errors"
}
},
"dataTextField": "Description",
"dataValueField": "Id"
});
});
你的第一个调用'dataSource.read'的函数看起来是正确的。它在调用时是否发出服务器请求来加载新数据?你可以包含从MVC助手生成的JavaScript? – CodingWithSpike 2014-10-28 17:03:01
@CodingWithSpike,检查我的编辑 – chiapa 2014-10-28 17:12:31
除了ID不同('优惠'vs'myDDL'),你的代码看起来是正确的。你对'dataSource.read()'的调用是否会向URL“/ ControllerName/fillDDL”发出一个请求? – CodingWithSpike 2014-10-28 17:40:23