Extjs checkcolumn disable for some rows, based on value

前端 未结 5 1434
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-16 14:07

I have a grid, with checkcolumn. It\'s dataIndex is, for example, \'checked\'.

I want to disable or hide checkboxes for some rows, where another value, \'can_be_chec

5条回答
  •  囚心锁ツ
    2020-12-16 14:34

    Using extjs 5 it is easier to return defaultRenderer in renderer method for target checkboxes and '' for others.

    renderer: function (value, metaData, record) {
        return (record.isLeaf()) ? '' : this.defaultRenderer(value, metaData);
    }
    

    Such won't render checkbox itself but all the events (i.e. checkchange, itemclick, etc) will be remained. If you don't want them either, you may disable them in beforesmth event, for example

    onBeforeCheckRequestsChange: function(me, rowIndex, checked, eOpts) {
        var row = me.getView().getRow(rowIndex),
            record = me.getView().getRecord(row);
        return !record.isLeaf();
    },
    

提交回复
热议问题