简体   繁体   中英

Didn't Get the updated value in data source.read function

My problem is that I'm setting the value in the filterA function on change event but when I call this.datasource.read() in the filterB function i don't get the updated value. My code so far:

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--"
  });
}

我发现该解决方案将数据源元素全局保存在oncreate函数中的某个位置,并在onchange函数中调用该函数以获得级联效果。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM