PDA

View Full Version : Grid - CheckboxSelectionModel - clearSelections



Zdeno
18 May 2010, 7:11 AM
Hello,

is there any way how i can uncheck checkbox which is in columnModel and which is selecting all rows? When i call


myGrid.getSelectionModel().clearSelections()

it clear selections only but the checkbox is still checked.

TIA

steffenk
18 May 2010, 7:44 AM
try myGrid.refresh(), though clearSelections should clear the checkboxes. Sure that the sm is bound correct?

Zdeno
19 May 2010, 1:36 AM
var gridCheckBox = new Ext.grid.CheckboxSelectionModel();
var columnModel = new Ext.grid.ColumnModel([
gridCheckBox,
{ id: 'go-payout-gen-username', header: GO.lang.strName, sortable: true, dataIndex: 'name' }
]);
columnModel.defaultSortable = true;
this.gridPanel = new Ext.grid.GridPanel({
store: new Ext.data.JsonStore({
url: GO.settings.modules.payout.url+ 'json.php',
baseParams: {
task: 'users',
auth_type: 'read'
},
root: 'results',
id: 'id',
totalProperty:'total',
fields: ['id','username','acl_read','acl_write','name'],
remoteSort: true
}),
sm: gridCheckBox,
loadMask: true,
cm: columnModel,
autoExpandColumn: 'go-payout-gen-username'
});


In show function of window where is grid generated using this code:




this.gridPanel.getSelectionModel().clearSelections();
this.gridPanel.getView().refresh();
this.gridPanel.getStore().load();


Checked rows are in next open window unchecked but checkbox in header is still checked. Prolly need to do something with columnModel, but really dont know what.

Condor
19 May 2010, 3:13 AM
You can turn the header checkbox off with:

Ext.fly(grid.getView().getHeaderCell(grid.getColumnModel().getIndexById('checker')).firstChild).removeClass('x-grid3-hd-checker-on');

steffenk
19 May 2010, 3:18 AM
so this looks like a bug in checkbox sm - this should be done with clearSelections() ;)

darren102
23 Jun 2010, 3:00 PM
Did you try the deSelectAll() function that comes with the selection model?

this.gridPanel.getSelectionModel().deSelectAll();

Condor
23 Jun 2010, 11:23 PM
There is no deSelectAll() method!

The fact that the header checkbox state isn't maintained is a know 'feature' of CheckboxSelectionModel.