I've seen how you can make a column editable / non-editable within a kendo grid, but how do I make a certain column editable from a button outside the grid?
我已经看到了如何在一个kendo网格中使列可编辑/不可编辑,但是如何通过网格外的按钮使某个列可编辑?
The grid starts off as not editable but when a button is clicked outside the grid, it is to make "Column 2" editable. Can this be done?
网格开始时不可编辑,但是当在网格外单击按钮时,将使“第2列”可编辑。可以这样做吗?
<button id="Edit">Edit</button>
<div id="grid"></div>
$('#grid").kendoGrid({
pageable: true,
editable: false,
etc...
columns: [
{ field: "Column 1", title: "Column 1" }
{ field: "Column 2", title: "Column 2" }
{ field: "Column 3", title: "Column 3" }
]
})
1 个解决方案
#1
4
Use the Grid's setOptions
method to enable editing on external button click:
使用Grid的setOptions方法在外部按钮单击上启用编辑:
$("#Grid-ID").data("kendoGrid").setOptions({ editable: true });
This will make all bound columns editable, unless you have disabled editing for specific fields via the schema.model.fields
configuration, as shown in the Grid Batch Editing example.
这将使所有绑定列都可编辑,除非您已通过schema.model.fields配置禁用了对特定字段的编辑,如Grid Batch Editing示例中所示。
SomeFieldName: { editable: false }
#1
4
Use the Grid's setOptions
method to enable editing on external button click:
使用Grid的setOptions方法在外部按钮单击上启用编辑:
$("#Grid-ID").data("kendoGrid").setOptions({ editable: true });
This will make all bound columns editable, unless you have disabled editing for specific fields via the schema.model.fields
configuration, as shown in the Grid Batch Editing example.
这将使所有绑定列都可编辑,除非您已通过schema.model.fields配置禁用了对特定字段的编辑,如Grid Batch Editing示例中所示。
SomeFieldName: { editable: false }