Kendo UI grid conditionally editable cell

2019-09-02 04:53发布

问题:

I am trying to do conditionally editable cells in kendo by writing code:

   edit: function (e) {                         
      var kendoTextBox = e.container.find("input[name=Ordertype]")[0];
      if (kendoTextBox)
        kendoTextBox.enable(e.model.RequestAmount == 0);
    },

The ordertype column should be editable when RequestAmount column is 0, but is not. Can someone tell me where am I wrong?

回答1:

Try this

edit: function (e) {
    var kendoTextBox = e.container.find("input[name=Ordertype]")[0];
    if (kendoTextBox && e.model.RequestAmount !== 0) 
        this.closeCell();
}