首先加载Kendo UI网格

时间:2012-12-10 16:47:13

标签: javascript html kendo-ui

我遇到了Kendo UI Grid的问题。当我加载数据时(来自返回json数据格式的异步请求),网格不能正确呈现网格的页脚。当我点击订购或页面网格时,它渲染得很好。我的问题是:如何纠正这个错误?

查看图片。

首次加载:

enter image description here

按代码排序后,页脚看起来没问题。

enter image description here

如果有人知道如何更正此错误并分享,我真的很感激。

谢谢。

客户端代码(Kendo版本:v2012.3.1114)

<script>

    var grid;

    $(document).ready(function () {
        var serviceUrl = "@Url.Action("GetAsyncData", "Home")";

        grid = $("#grid").kendoGrid({
            dataSource: {
                type: "json",
                transport: {
                    read: {
                        dataType: "json",
                        url: serviceUrl,
                        cache: false
                    }
                },
                schema: {
                    data: "data",
                    total: "count",
                    model: {
                        id: "Id"
                    }
                }               
            },
            height: 400,
            toolbar: [{ text: "New", className: "add-button" }],
            groupable: true,
            sortable: true,
            pageable: false,
            selectable: true,
            resizable: true,
            columns: [
                {
                    field: "Code",
                    title: "Cód.",
                    width: "150px",
                    filterable: true,
                    groupable: false,
                    sortable: true,
                    resizable: true
                },
                {
                    field: "Name",
                    title: "Nome",
                    filterable: true,
                    groupable: false,
                    sortable: true,
                    resizable: true
                }, {
                    field: "Contact",
                    title: "Contato",
                    encoded: false,
                    filterable: true,
                    groupable: true,
                    sortable: true,
                    resizable: true
                },
                { command: { name: "Editar", text: "", className: "edit-button custom-button edit" }, title: "", width: "50px", filterable: false, sortable: false, groupable: false, resizable: false },
                { command: { name: "Detalhes", text: "", className: "detail-button custom-button detail" }, title: "", width: "50px", filterable: false, sortable: false, groupable: false, resizable: false },
                { command: { name: "Excluir", text: "", className: "delete-button custom-button delete" }, title: "", width: "50px", filterable: false, sortable: false, groupable: false, resizable: false }
            ]
        }).data("kendoGrid");

        $("#grid").delegate(".add-button", "click", function (e) {
            window.location = '@Url.Action("Create")';
        });
    });

</script>

<div id="grid"></div>

1 个答案:

答案 0 :(得分:-3)

您使用的是什么版本的剑道?我无法使用Q3版本

复制行为