Switch off / on Kendo UI grid editable mode

爷,独闯天下 提交于 2019-12-08 11:21:32

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}); 
});

Your JSFiddle modified here: http://jsfiddle.net/OnaBai/mnmm1bqw/4/

Use edit function and global variable to disable and enable edit mode

some thing like below

var globFlag=true;

$("#grid").kendoGrid({

  ...

  edit:  function(e) {
            if ( globFlag ) {
               this.closeCell();
            }
        }

  ...

});


$('.change-mode').click(function(){
          if(globFlag)
               globFlag=false;
          else
               globFlag=true;

 });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!