簡體   English   中英

在數據source.read函數中未獲取更新的值

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

我的問題是我在更改事件時在filterA函數中設置值,但是當我在filterB函數中調用this.datasource.read() ,我沒有得到更新后的值。 到目前為止,我的代碼:

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函數中調用該函數以獲得級聯效果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM