2015-02-24 76 views
0

我想让Kendo网格中的单元格有条件编辑。例如,当“状态”列为0时,只有“值”列可以编辑。这是我试过的:grid_AngularJS中有条件编辑的kendo单元格

{  field: "Quantity", 
     title: "Value", 
     width: "100px", 
     template: '#= kendo.toString(Quantity, "n2")# #=UnitOfMeasure#', 
     attributes: {style: "text-align: right;"}, 
     **editable:"#if(Status == '0') {#true#} else{#false#}#",** 
    }, 

但它不起作用。有人有线索吗?谢谢

+0

possib le复制[在kendo网格中只允许单元格在条件满足的情况下](http://stackoverflow.com/questions/20881484/make-cell-readonly-in-kendo-grid-if-condition-is-met) – 2015-02-24 17:05:48

回答

0

你不能在网格初始化应用条件的编辑,但你一定能够对编辑的事件条件,并有控制功能如下(我用剃刀,所以代码是使用剃刀):

.Events(事件=>事件 .Edit( “ShowBookingPopup”)

function ShowBookingPopup(e) { 
    // Your custom condition to allow/block editing 
    if (true) { //Access Model via e.Model 
    .... Your logic 
    } else { // condition incorrect 
     e.preventDefault(); 
    } 

}