1

Is there a way to disable certain cells in the grid from being edited if that have a certain class.

For instance once of my columns is:

{
        field: 'manufacturerId',
        headerTemplate: '<b>Manufacturer</b>',
        width: '150px',
        editor: manufacturerEditor,
        template: '#=(manufacturer ? (manufacturer == 0 ? "-" : manufacturer) : "<span class=\\\"disabled-cell\\\">-</span>")#'
    },

You can see if manufacturer is null, then span with class 'disabled-call' is put inside the cell.

How can I make it so any cell that is normally editable, non-editable when it contains a space with class 'disabled-cell'?

I also want this to work for cells that have custom editors, such as kendo drop down lists (I don't want the list widget or any part of it to appear when the user clicks a disabled cell).

The cells containing this disabled class will become enabled when another cell in the same row is filled out, I would greatly appreciate if someone could give me some ideas on how to do this too?

imperium2335
  • 23,402
  • 38
  • 111
  • 190

1 Answers1

1

Take a look at the edit event of the grid

http://docs.telerik.com/kendo-ui/documentation/api/web/grid#events-edit

        edit: function (e) {
            var editable = e.container.find("input").hasClass("disabled-cell");


            if (!editable) {
                this.closeCell(); // prevent editing
            }
        }
G-Man
  • 7,232
  • 18
  • 72
  • 100
  • For this to work would I have to apply the disabled class to my inputs? Is there a way to set the class of each cell in the grid easily? – imperium2335 Jun 15 '14 at 08:41