Javascript 网格_AngularJS中有条件可编辑的剑道单元

Javascript 网格_AngularJS中有条件可编辑的剑道单元,javascript,angularjs,kendo-ui,kendo-grid,Javascript,Angularjs,Kendo Ui,Kendo Grid,我想使剑道网格中的单元格有条件地可编辑。例如,当“状态”列为0时,只有“值”列才应可编辑。以下是我尝试过的: { field: "Quantity", title: "Value", width: "100px", template: '#= kendo.toString(Quantity, "n2")# #=UnitOfMeasure#', attributes: {style: "text-align: right

我想使剑道网格中的单元格有条件地可编辑。例如,当“状态”列为0时,只有“值”列才应可编辑。以下是我尝试过的:

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

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

为此,您需要使用网格的编辑事件。此论坛帖子将帮助您:


您不能在grid Init应用条件编辑,但您肯定可以在edit event上设置一个条件,并控制该功能,如下所示(我使用了Razor,因此代码使用Razor):

.Events(Events=>Events .编辑(“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();
    }

 }