0

我正在尝试根据从选择下拉列表中选择的选项“过滤”网格。

How do I send the selected option value to the grid when the change event on the select dropdown fires?

我的网格数据源是:

dataSourceParts = new kendo.data.DataSource({
    serverPaging: false,
    serverFiltering: false,
    serverSorting: false,
    transport: {
        read: {
            url: ROOT + 'shipment/partsSerialGrid',
            dataType: 'json',
            type: 'POST',
            data: {
                enquiryId: enquiryId
            }
        }
    },
    pageSize: 25,
    error: function(e) {
        alert(e.errorThrown + "\n" + e.status + "\n" + e.xhr.responseText);
    },
    schema: {
        data: "data",
        total: "rowcount",
        model: {
            id: 'id',
            fields: {
                quantity: {
                    type: 'number',
                    editable: false
                },
                idealForm: {
                    type: 'string',
                    editable: false
                },
                serial: {
                    type: 'string',
                    editable: true
                }
            }
        }
    }
})

我的选择事件:

$('#fromNameSelect').change(function() {
            var fromMode = $('#fromSelect').val();
            if (fromMode == 2)
            {
                supplierId = $(this).val();
                dataSourceParts.filter({
                    field: 'test', operator: 'eq', value: 'test' // THIS DOES NOTHING.
                });
                $('#shippingPartsGrid').data('kendoGrid').dataSource.read();
            }
        })
4

2 回答 2

0
$('#fromNameSelect').change(function() {
            var fromMode = $('#fromSelect').val();
            if (fromMode == 2)
            {
                supplierId = $(this).val();
                 $('#shippingPartsGrid').data('kendoGrid').dataSource.filter({
                    field: 'test', operator: 'eq', value: 'test' // DO IT LIKE THIS
                });
            }
        })
于 2014-03-12T12:51:37.987 回答
0

我无法证实这一点。但是由于您在 dataSourceParts 中设置了过滤器。你不应该使用dataSourceParts.read()而不是$('#shippingPartsGrid').data('kendoGrid').dataSource.read();吗?

于 2014-03-12T10:20:58.860 回答