Javascript 未在data source.read函数中获取更新的值
我的问题是,我正在更改事件上设置filterA函数中的值,但是当我在filterB函数中调用this.datasource.read时,我没有得到更新的值。到目前为止,我的代码是:Javascript 未在data source.read函数中获取更新的值,javascript,kendo-ui,kendo-grid,kendo-asp.net-mvc,Javascript,Kendo Ui,Kendo Grid,Kendo Asp.net Mvc,我的问题是,我正在更改事件上设置filterA函数中的值,但是当我在filterB函数中调用this.datasource.read时,我没有得到更新的值。到目前为止,我的代码是: function FilterA(element) { element.kendoDropDownList({ dataSource: { transport: { read: '@Url.Action("Filter_A")'
function FilterA(element) {
element.kendoDropDownList({
dataSource: {
transport: {
read: '@Url.Action("Filter_A")'
}
},
change: function (e) {
var index = 1;
var temp = "";
$(".k-input").each(function () {
if (index === 3) {
temp = $(this).text();
}
index++;
});
index = 1;
$('#hdntemp').val(temp);
},
optionLabel: "--Select Value--"
});
}
function FilterB(element) {
element.kendoDropDownList({
dataSource: {
transport: {
read: '@Url.Action("Filter_B")' + "?temp=" + $('#hdntemp').val()
}
},
open: function (e) {
this.dataSource.read();
},
optionLabel: "--Select Value--"
});
}
我找到了解决办法
将datasource元素全局保存在oncreate函数中的某个位置,并在onchange函数中调用该函数以获得级联效果