1

您如何使“城市”列中的下拉值根据选择的州进行过滤,以便仅显示该州内的城市?

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

1 回答 1

0

这就是我设法做到我的方式:

    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({});
    }
}
于 2013-05-31T10:25:23.913 回答