0

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

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
Aviator
  • 613
  • 4
  • 11
  • 26
  • possible duplicate of [Make cell readonly in Kendo Grid if condition is met](http://stackoverflow.com/questions/20881484/make-cell-readonly-in-kendo-grid-if-condition-is-met) – Lars Höppner Feb 24 '15 at 17:05

2 Answers2

0

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

Kendo UI Grid Conditional editing

Community
  • 1
  • 1
knikolov
  • 1,650
  • 1
  • 12
  • 18
0

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

 }
D_Learning
  • 1,033
  • 8
  • 18