Kendo Grid自定义命令按钮单击事件不会触发

时间:2012-12-24 10:34:04

标签: backbone.js kendo-ui

我使用主干收集和kendo网格加载了一些数据。我添加了一个自定义更新命令并分配了一个事件,但偶数不会触发。请帮忙。

$("#grid").kendoGrid({



             editable: true,
             batch: true,

          columns: ["Name", "Description", "Date", { command: { text: "Update Me",    name:"Update", click: onEdit }, title: " ", width: "140px"}],
            dataSource: {

                schema: {
                    model: docWrapper


                    },
                 data: new documentlistWrapper((window.docs))

              },


            pageSize:5

        });

    }
    });

function onEdit(e)
{

    alert("hello");
}

1 个答案:

答案 0 :(得分:3)

您的大括号({})未正确平衡。试试这个:

$("#grid").kendoGrid({
    editable  : true,
    batch     : true,
    columns   : ["Name", "Description", "Date", { command: { text: "Update Me", name: "Update", click: onEdit }, title: " ", width: "140px"}],
    dataSource: {
        schema: {
            model: docWrapper
        },
        data  : new documentlistWrapper((window.docs))
    },
    pageSize  : 5
});

function onEdit(e) {
    alert("hello");
}