这可能吗?现在我有:
kendoGrid = gridObj.kendoGrid({
dataSource: gridDataSource,
editable: "popup",
});
哪个效果很好,但是我希望编辑以内联方式进行,仅在弹出窗口中添加行,这可能吗?
最佳答案
糟糕,这将有些棘手。我要做的是默认情况下将网格定义为可编辑的inline
,然后定义我自己的创建按钮,在我的自定义创建按钮的处理程序中,我暂时将editable
模式更改为popup
,然后(一旦弹出打开)将其还原为inline
。就像是:
var grid = $("#grid").kendoGrid({
dataSource: ds,
toolbar: [
{
// My own version of "Add new record" button, with name **popup**
text : "Add new record",
name: "popup",
iconClass: "k-icon k-add"
}
],
// By default is **inline**
editable: "inline",
...
}).data("kendoGrid");
// Event handler for my **popup** button defined in the grid toolbar
$(".k-grid-popup", grid.element).on("click", function () {
// Temporarily set editable to "popup"
grid.options.editable = "popup";
// Insert row
grid.addRow();
// Revert editable to inline
grid.options.editable = "inline";
});
您可以在这里看到它:http://jsfiddle.net/OnaBai/7nj0pxwz/