无法使用模板在Kendo Grid上启用过滤器行?

时间:2015-01-16 03:34:27

标签: kendo-ui telerik kendo-grid

我想在此版本中启用过滤器行:http://demos.telerik.com/kendo-ui/grid/filter-row

但它只显示过滤器图标,这是我的初始化kendo网格的代码:

        function GetTicket() {
        $("#grid").kendoGrid({
            dataSource: {
                transport: {
                    read: function (options) {
                        $.ajax({
                            type: "POST",
                            url: "Providers/WebMethods/Method.asmx/GetTicketGrid",
                            data: JSON.stringify(DTO),
                            contentType: "application/json; charset=utf-8",
                            dataType: "json",
                            error: function (a) {
                                alert(a.responseText);
                            },
                            success: function (msg) {
                                options.success($.parseJSON(msg.d));
                            }
                        });
                    }
                },
                pageSize: pageSize,
                serverPaging: true,
                serverFiltering: true,
                schema: {
                    total: function (data) {
                        if (data.length != 0) {
                            emptyRecord = false;
                            return data[0].TotalRows;
                        }
                        else {
                            emptyRecord = true;
                            return 0;
                        }
                    },
                    model: {
                        fields: {
                            IssuesID: { type: "int" },
                            ShortTitle: { type: "string" },
                            Title: { type: "string" },
                            CustomerName: { type: "string" },
                            SKU: { type: "string" },
                            SupportOptionName: { type: "string" },
                            CaseReasonName: { type: "string" },
                            TicketStatusName: { type: "string" },
                            CreatedDate: { type: "date" },
                            DueDate: { type: "date" },
                            AssignedToSupport: { type: "string" }
                        }
                    }
                }
            },
            dataBound: function (e) {
                //e.preventDefault();
                if (this.dataSource.totalPages() == 1) {
                    this.pager.element.hide();
                }
                DisplayNoResultsFound($('#grid'));
            },
            filterable: {
                mode: "row"
            },
            pageable: {
                refresh: true,
                buttonCount: 5,
                change: function (e) {
                    // e.preventDefault();
                    var res = $('#grid').data('kendoGrid').dataSource;
                    currentPage = res.page();
                    SetParamGrid();
                    res.read();
                }
            },
            sortable: true,
            change: onChange,
            selectable: true,
            autoBind: false,
            rowTemplate: kendo.template($("#rowTemplate").html()),
            columns: [
            { field: "", title: "", width: 45,filterable: {cell: {showOperators: false}} },
            { field: "IssuesID", title: "ID", filterable: { cell: { showOperators: "contains"}} },
            { field: "ShortTitle", title: "Title", filterable: { cell: { showOperators: "contains"}} },
            { field: "CustomerName", title: "CustomerName", filterable: { cell: { showOperators: "contains"}} },
            { field: "SKU", title: "SKU", filterable: { cell: { showOperators: "contains"}} },
            { field: "SupportOptionName", title: "Support Option", filterable: { cell: { showOperators: "contains"}} },
            { field: "CaseReasonName", title: "Case Reason", filterable: { cell: { showOperators: "contains"}} },
            { field: "TicketStatusName", title: "Status", filterable: { cell: { showOperators: "contains"}} },
            { field: "CreatedDate", title: "Created", format: "{0:MM-dd-yyyy}", filterable: { cell: { showOperators: "contains"}} },
            { field: "DueDate", title: "Modified", format: "{0:MM-dd-yyyy}", filterable: { cell: { showOperators: "contains"}} },
            { field: "AssignedToSupport", title: "Assigned To", filterable: { cell: { showOperators: "contains"}} },
            { field: "", title: "#", filterable: { cell: { showOperators: false}} }
            ]
        });
        var grid = $('#grid').data('kendoGrid');
        grid.dataSource.read();
        GetVisibleColumn();
    }

任何人都可以帮助我吗?之后,您能告诉我如何将过滤器参数发送到服务器吗?

1 个答案:

答案 0 :(得分:1)

您可能正在使用不支持过滤器行功能的旧版本。升级到更新版本。

要发送过滤器参数,请使用数据源的parameterMap