PDA

View Full Version : CheckboxSelectionModel problem



Filipe.Panceri
2 Dec 2010, 12:24 PM
Hi for everyone,

in my app i have one grid with many columns and one is a CheckboxSelectionModel. When i select one register works fine but i cant remove the selection... I try to use this code to force deselect register but not work.


var sm = new Ext.grid.CheckboxSelectionModel([
{
header: 'Estado calibração',
id: 'checkboxSelection',
width: 171,
dataIndex: 'fieldEstadoCalibracao',
}
]);
var grdEstadoCalibra = new Ext.grid.GridPanel({
store: storeJuntores,
enableColumnHide: false,
enableHdMenu: false,
cls: 'grid_b',
id: 'grdEstadoCalibra',
columns: [
{
header: 'Teste',
width: 80,
dataIndex: 'fieldTeste'
},sm],
height: 400,
width: 640,
listeners: {
cellclick: function(a, b, c, d){
//this line generate one exception:
//this.grid is undefined var r = typeof index == "numbe...this.grid.store.getAt(index) : index;
if (sm.isSelected(b)) {
sm.unlock();
sm.deselectRow(b);
sm.lock();
}
else {
sm.unlock()
sm.selectRow(b, true)
sm.lock()
}
}
}

});

Anyone have some idea ??

mankz
2 Dec 2010, 12:52 PM
You don't have to listen to cellclick etc, just set selModel : sm, and it should work fine

Filipe.Panceri
2 Dec 2010, 1:12 PM
Thanks for answer, but i'm newbie in Ext and don't understand your sugestion... Can you send any example ??

Condor
3 Dec 2010, 6:22 AM
It's not that hard.

1. Remove the cellclick listener.
2. Add selModel:sm to the grid config.