kendo网格最大调用堆栈超出错误

时间:2017-05-17 14:11:45

标签: javascript kendo-ui kendo-grid kendo-datasource

问题

我试图简单地将一个对象数组传递给kendo.data.HierarchicalDataSource,然后我将该DataSource设置为我的kendo网格的DataSource。

当我尝试这样做并且想知道如何调试问题时,我一直收到Maximum Call Stack Exceeded错误。

代码

因此,当用户点击打开按钮时,它将触发一个将填充的事件,创建 DataSource 并将填充它,如下所示:

var pDataSource = new kendo.data.HierarchicalDataSource({
    page: 1,
    data: session.UserDetails.Routes,
    schema: {
        model: {
            hasChildren: "Routes",
            fields: {
                guid: { type: "string" },
                description: { type: "string" },
                created: { type: "string" }
            }
        }
    },
    pageSize: 50,
    serverPaging: false,
    serverFiltering: false,
    serverSorting: false,
    filter: { field: "id", operator: "neq", value: "0" }
});

session.UserDetails.Routes数组看起来像:

enter image description here

然后我只需将我的kendoGrid上的DataSource设置为我刚才创建的DataSource:

    $("#routeGrid").kendoGrid({
        dataSource: pDataSource,

        filterable: true,
        scrollable: true,
        sortable: true,
        resizable: true,
        pageable: {
            refresh: true,
            pageSizes: true
        },
        columns: [{
            field: "description",
            title: "Title"
        },
        {
            field: "activityTypeDesc",
            title: "Activity"
        },
        {
            field: "created",
            title: "Created",
            template: "#= kendo.toString(kendo.parseDate(created, 'yyyy-MM-dd'), 'dd/MM/yyyy' ) #"
        },
        {
            command: [
        {
            name: "Open",
            template: "<div class='k-button grid-button'><i id='img_Open' class='fa fa-folder-open' aria-hidden='true' onclick='getGridGuidOpen(this)'></i></div>",
            click: getGridGuidOpen
        },
        {
            name: "Sync",

            template: "<div class='k-button grid-button'><i id='img_Sync' class='fa fa-refresh' aria-hidden='true'></i></div>",

            click: getGridGuidSync
        },
        {
            name: "Delete",
            template: "<div class='k-button grid-button'><i id='img_Delete' class='fa fa-times' aria-hidden='true' onclick='getGridGuidDelete(this)'></i></div>",

            click: getGridGuidDelete
        }]
        }]
    });

因此,每当用户再次单击“打开”时,将运行相同的代码。任何人都可以看到我正在做的事情的问题吗?

0 个答案:

没有答案