关闭/打开 Kendo UI 网格可编辑模式 [英] Switch off / on Kendo UI grid editable mode
本文介绍了关闭/打开 Kendo UI 网格可编辑模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Kendo 网格
,其中网格的可编辑选项需要根据某个标志打开/关闭.有人可以帮助它如何实现.
I am using a Kendo grid
where grid's editable option needs to be switched on / off based some flag. Can somebody help that how can it be achieved.
<button class="change-mode">Change Edit Mode</button>
$('.change-mode').click(function(){
//Swit ched on /off here based on some flag
//console.log($("#grid"));
$("#grid").options.editable = false;
});
这是jsfiddle
推荐答案
如果您使用的是最新版本的 KendoUI(2014 Q3),则无法直接更改 options
,但可以使用 setOptions
.
If you are using the latest release of KendoUI (2014 Q3) you cannot change options
directly but you can use setOptions
.
<button class="change-mode">Change Edit Mode</button>
$('.change-mode').click(function(){
//Swit ched on /off here based on some flag
var grid = $("#grid").data("kendoGrid");
var enabled = grid.options.editable !== false;
grid.setOptions({editable: !enabled});
});
您的 JSFiddle 在这里修改:http://jsfiddle.net/OnaBai/mnmm1bqw/4/一个>
Your JSFiddle modified here: http://jsfiddle.net/OnaBai/mnmm1bqw/4/
这篇关于关闭/打开 Kendo UI 网格可编辑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文