剑道分组不起作用

时间:2014-01-29 10:40:35

标签: kendo-ui kendo-grid

我有一个kendo网格,我已经启用了分组。问题是有时分组不起作用。

它在顶部显示一个带有禁用符号的圆圈。

以下是我的网格代码:

$("#divGrid").kendoGrid({
        dataSource: {
            transport: {
                read: function (options) {
                    var webMethod = "Portal.aspx/DisplayNotes";
                    $.ajax({
                        type: "POST",
                        url: webMethod,
                        data: displayParams,
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (result) {
                            options.success(result.d);
                        }
                    })
                }
            },
            schema: {
                model: {
                    id: "ID",
                    fields: {
                        ID: { editable: false, nullable: true },
                        IsDeleted: { type: "boolean" },
                        Text: { type: "string" },
                        CreatedByDisplayName: { type: "string" },
                        CreatedDateTime: { type: "date" },
                        Order: { type: "number" },
                        PermissionType: { type: "string" },
                        LastEditedByUserGUID: { type: "string" },
                        GUID: { type: "string", validation: { required: true } },
                    }
                }
            },
            pageSize: 5
        },
        dataBound: onDataBound,
        batch: true,
        edit: function (e) {
            // To stop the Auto Refresh of the grid on edit
            isEditing = true;
        },
        groupable: true,
        scrollable: true,
        sortable: true,
        reorderable: true,
        toolbar: "<div><img id='imgExportDoc' style='margin-left:15px' onclick='ExportData(1);' title='Export in Word Format' src='images/doc-Icon.png'/><img id='imgExportExcel' onclick='ExportData(2);' style='margin-left:15px' title='Export in Excel Format' src='images/xls-Icon.png'/><img id='imgExportPDF' style='margin-left:15px' onclick='ExportData(3);' title='Export in PDF Format' src='images/pdf_icon.jpg'/></div>",
        resizable: true,
        selectable: "row",
        autoSync: true,
        editable: true,// "inline",
        navigatable: true,
        columnMenu: true,
        pageable: {
            refresh: true,
            pageSizes: true,
            buttonCount: 5
        },
        columns: [
        {
            field: "ID", width: width0, title: "Note ID", template: function (dataItem) {
                if (typeof dataItem.Id != "string") {
                    return "<a target=\"_blank\" href=\"http://www.google.com\">" + dataItem.ID + "</a>";
                } else {
                    return dataItem.ID;
                }
            }
        },
        { field: "IsDeleted", width: width1, title: "IsDeleted" },
        { field: "Text", title: "Note Text", width: width2 },
        { field: "CreatedDateTime", title: "Created Datetime", width: width3 },
        { field: "Order", title: "Order", width: "140px", width: width4 },
        { field: "PermissionType", title: "Permission Type", width: width5 },
        { field: "LastEditedByUserGUID", title: "Last Edited By", editor: ddlSimpleEditor, width: width6 },
        { command: { text: "Delete", click: deleteNoteData }, title: "Delete", width: width7, menu: false },
        { field: "GUID", hidden: true, title: "Hidden", menu: false, width: width8 }]
        , filterable: true,
        columnMenu: {
            sortable: false
        }
    });

可能是什么原因。

还想知道如何动态设置剑道网格的高度。

2 个答案:

答案 0 :(得分:1)

下面是动态高度的代码:

//Below code is for defining the height of the grid
    $(".k-grid-content").height('400');

只需参考最新的Kendo UI程序集,您的分组问题就会被删除。

答案 1 :(得分:1)

我遇到了问题,实际上你没有在重新绑定它之前正确地破坏网格:

以下是适当销毁的代码:

var grid = $("#YourGridName").data("kendoGrid");
        if (grid) {

            //destroy the previous Grid instance
            grid.destroy();

            //clean up the html
            grid.wrapper.html("");
        }

希望这有帮助。