簡體   English   中英

用Kendo網格鏈接列過濾器

[英]Chaining column filters with Kendo grid

如何使“城市”列中的下拉值根據選擇的州進行過濾,以便僅顯示該州內的城市?

function cityFilter(element) {
    element.kendoDropDownList({
        dataSource: {
            transport: {
                read: "http://localhost:8888/City.php",
                dataType: "json"
            },
            schema: {
                data: "data"
            }
        },

        dataTextField:"City",
        dataValueField:"City",
        optionLabel: "--Select Value--"
    });
}

function stateFilter(element) {
    element.kendoDropDownList({
        dataSource: {
           transport: {
                read: "http://localhost:8888/State.php",
                dataType: "json"
            },
            schema: {
                data: "data"
            }
        },

        dataTextField:"State_Long",
        dataValueField:"State_Long",
        optionLabel: "--Select Value--"
    });
}

這就是我設法做的事情:

    function deviceFilter(element) {
    element.kendoDropDownList({
        dataTextField: "DeviceTypeName",
        dataValueField: "DeviceTypeName",
        dataSource: {
            transport: {
                read: "@Url.Action("DeviceTypes", "Device")"
            }
        },
        optionLabel: "--Select Value--",
        change: deviceFilterChange
    });
}

function deviceFilterChange() {
    var value = this.value(),
          grid = $("#DevicesRadGrid").data("kendoGrid");

    if (value) {
        grid.dataSource.filter({ field: "DeviceType", operator: "eq", value: value });
    } else {
        grid.dataSource.filter({});
    }
}

暫無
暫無

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

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