4

I want to disable a particular checkbox for a row depending on values for other column.

I looked at the question here .But all the answers here just modify the css .

I don't want just the updated css . I want to actually disable the checkbox for clicking.

Is there any way to achieve this?

Community
  • 1
  • 1
Aditya Korti
  • 692
  • 2
  • 12
  • 28

3 Answers3

6

you can do like this way also
check fiddle :
https://fiddle.sencha.com/#view/editor&fiddle/1maa

    var userStore = Ext.create('Ext.data.Store', {
    data: [{
        "id": 1,
        "abbr": "AL",
        "name": "Alabama",
        "completed":false
    }, {
        "id": 2,
        "abbr": "AK",
        "name": "Alaska",
        "completed":false
    }, {
        "id": 3,
        "abbr": "AZ",
        "name": "Arizona",
        "completed":false
    }]
});

Ext.create('Ext.grid.Panel', {
    renderTo: document.body,
    store: userStore,
    width: 400,
    height: 200,
    title: 'Application Users',
    columns: [{
        width: 25,
        align: 'left',
        xtype: 'checkcolumn',
        tdCls: 'checkBoxColum',
        dataIndex: 'completed',
        renderer: function (value, meta, record, row, col) {
            /* Permission Check */
            var me = this;

            if(record.data.id==1)
            {
                meta['tdCls'] = 'x-item-disabled';
            }else
            {
                meta['tdCls'] = '';
            }
            return new Ext.ux.CheckColumn().renderer(value);
        }
    }, {
        text: 'name',
        width: 100,
        sortable: false,
        hideable: false,
        dataIndex: 'name'
    }]
});
Ajay Thakur
  • 1,066
  • 7
  • 23
0

Check this fiddle

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

I have done this using editor check box along with checkcolumn.

Surya Prakash Tumma
  • 2,153
  • 4
  • 27
  • 47
0

My solution for ExtJS 4

{
   xtype: 'checkcolumn',
   dataIndex: 'Check',
   width: 30,
   renderer: function (value, metaData, record) {
       return record.get('isDisabled') ? '' :
              (new Ext.grid.column.CheckColumn()).renderer(value);
   }
}

Need to add next settings to grid:

selModel: Ext.create('Ext.selection.CellModel', {
    mode: 'SIMPLE'
}),
V.Tur
  • 1,115
  • 9
  • 20