关闭/打开Kendo UI网格可编辑模式 [英] Switch off / on Kendo UI grid editable mode
本文介绍了关闭/打开Kendo UI网格可编辑模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Kendo grid
,其中需要基于某些标志打开/关闭网格的可编辑选项.有人可以帮忙实现它.
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屋!
查看全文