0
votes

I would like to make cells in Kendo grid conditionally editable. For example, when Status column is 0, only then Value column should be editable. Here is what I tried:

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

but it doesn't work. Does anyone have a clue? Thank you

2

2 Answers

0
votes

You need to use the edit event of the Grid for this purpose. This forum post will help you:

Kendo UI Grid Conditional editing

0
votes

You cannot apply conditional editing at grid Init, but you can surely have a condition on edit event and control the feature there as below (I have used Razor, so the code is using Razor):

.Events(events => 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();
    }

 }