Search code examples
javascriptextjscheckboxextjs6

How to disable cell on grid according to checkbox status extJs 6


I need to disable some cells according checkbox status is changed. I added a listener to a checkbox column:

listeners: {
    checkchange: function( me , rowIndex , checked , record , e , eOpts) {
        var row = me.getView().getRow(rowIndex);
        var columnIndex = Ext.getCmp('MyColumnIdToDisable').fullColumnIndex;
        Ext.get(row.childNodes[columnIndex]).setDisabled=!checked;
    }        
}

But I got this error:

Uncaught TypeError: Ext.get(...).setDisabled is not a function


Solution

  • You can use this.disabledCls I have already example which does probably the same as you need. It disables particular cell.

    https://fiddle.sencha.com/#view/editor&fiddle/1lvm

    onCheckcolumnCheckChange: function (checkcolumn, rowIndex, checked, record, eOpts) {
        // we need to get a grids view
        var view = Ext.first('#MySpecialGridId').getView();
        var cell = view.getCell(rowIndex,1);
    
        if (checked) {
            // add disabled cls -> disabled
            cell.addCls(this.disabledCls);
        }else{
            // remove the disabled cls -> enabled
            cell.removeCls(this.disabledCls)
        }
    }