View Full Version : [2.2] Ext.ux.grid.selectiveCheckboxSelectionModel

26 Mar 2009, 2:28 AM
Another one in my series of small but (for me) handy extensions: Ext.ux.grid.selectiveCheckboxSelectionModel lets you add a filter function to the grid that gets to decide if a certain row should have a checkbox (i.e. is selectable) or not, e.g. based on the row index or the record data.

Simply use Ext.ux.grid.selectiveCheckboxSelectionModel instead of the standard CheckboxSelectionModel and add a property to the grid config.

checkboxCondition: function(val, meta, rec, rowIdx, colIdx) {
if( rec.get('owner') == 'world' ) {
return true;
return false;
Example and Source (http://www.chrwinter.de/ext3/selectiveCheckboxSelectionModel.html)
Wiki entry (http://extjs.com/learn/Extension:SelectiveCheckboxSelectionModel)

26 Mar 2009, 4:42 AM
With this Ext.ux.grid.selectiveCheckboxSelectionModel, can we place a condn on the row being getting selected .

plz help..

26 Mar 2009, 5:17 AM
Can you give a more detailed description of what you want to do please?

26 Mar 2009, 6:01 AM
hi man
thankz for asking

here the problem is i have to select only one row and on the second selection it should trigger a popup saying that one selection is allowed.

i know that it is similar to a radio button . but for added fnality i have to use checkbox .

can u plz tell me whether the condn can be checked for more than one selection.

26 Mar 2009, 7:17 AM
I see. That would be a custom extension, you'd have to hook onto the beforeselect handler with a custom function hat checks if there is an existing selection and, if yes, shows the popup and returns false.

But you might be better off by simply passing 'singleSelect: true' to the constructor of the selectiveCheckboxSelectionModel (it's inherited from RowSelectionModel) to automatically unselect the old selection if another row gets selected.

27 Mar 2009, 12:21 AM
Thanks Bitpoet

singleselect:true was working fine .

14 May 2009, 7:20 PM
IE 6.0 and Firefox 2.0x not work.

15 May 2009, 1:16 AM
You're right, there was a compatibility issue in the code, I've fixed that. The version online (1.02) has been tested with IE6/7/8, Firefox3, Opera 9 and Google Chrome 1.0.

8 Jul 2009, 12:44 PM
Nice work BitPoet. Here's a slight improvement to your code:

You can rewrite your hasChecker method to the following one liner to utilize Ext's dom querying abilities:

hasChecker: function(node) {
return Ext.query('div[class*=x-grid3-row-checker]', node).length > 0;

10 Jul 2009, 2:42 AM
Nice one, thank you :). I've updated the code with that.

20 Mar 2010, 1:32 PM
What about multiple selects with shift+click like gmail?
There is also a jquery plugin that can be used for inspiration