PDA

View Full Version : Disable/Gray out checkbox in Ext.selection.CheckboxModel



Mathew567
7 Jul 2015, 12:58 PM
Hi,

I would like know , is there any way to disable/gray out the checkbox in Ext.selection.CheckboxModel (for certain rows, not for all rows)
on selectionchange event, I need to disable/grayout checkbox based on some conditions. (currently I am using deselect method to stop selecting the checkbox, but the checkbox looks active which is misleading, so I want to disable the checkbox)

Is there any way I can get the reference to checkbox (for each row) in CheckboxModel, so that I can iterate through each checkbox and disable/enable conditionally.

If possible can you give me the sample code to enable/disable the checkbox’s (for certain rows, not for all rows)

I am using extjs 4.2.1

Is it possible to get a extjs 4.2.1 version of the following code, I got this code from

https://www.sencha.com/forum/showthread.php?42683-How-to-Disable-hide-the-check-box-of-CheckboxSelectionModel-grid


Ext.grid.CheckboxSelectionModel.override({
hideCheckbox: function() {
var cm = this.grid.getColumnModel();
var idx = cm.getIndexById(this.id);
cm.setHidden(idx, true);
},
showCheckbox: function() {
var cm = this.grid.getColumnModel();
var idx = cm.getIndexById(this.id);
cm.setHidden(idx, false);
}
});

mySm.hideCheckbox();
//or
myGrid.getSelectionModel().hideCheckbox();


Thanks in advance.

Gary Schlosberg
8 Jul 2015, 3:46 PM
I haven't tried this myself, but here's a few threads that look promising:
https://www.sencha.com/forum/showthread.php?237641
https://www.sencha.com/forum/showthread.php?268401

Sounds like you might have to create a custom renderer.