PDA

View Full Version : Problem with deselect all with customized checkbox model



renganathan
27 Sep 2012, 9:49 PM
Hi All,

I have customized the checkbox model , to disable some of the rows in the grid which has the specific value.

Customized check box model works fine, when select all using header check box but the problem is not deselecting all

I shared the code here,


var SelectionModel = new Ext.selection.CheckboxModel(
{
listeners :
{
checkOnly : true,
beforeSelect : function(sm,record)
{
if (record.get('relation') == 'child')
{
return false;
}
},
selectionchange : function(model, record, options)
{
if (model.getCount())
{
Ext.getCmp('xxxx').enable();
}
else
{
Ext.getCmp('xxxx').disable();
}
}

,scope : this
},
renderer : function(value, metaData, record, rowIndex, colIndex, store, view)
{
var baseCSSPrefix = Ext.baseCSSPrefix;
metaData.tdCls = baseCSSPrefix + 'grid-cell-special ' + baseCSSPrefix + 'grid-cell-row-checker';
if(record.get('relation') == 'child') { return ''; } else{ return '<div class="' + baseCSSPrefix + 'grid-row-checker"> </div>'};
}
});


can you guys tell me how to fix this problem?

mitchellsimoens
2 Oct 2012, 8:28 AM
Instead of overriding the methods when you create an instance, why not extend the checkbox selection model and use that new class in your grid?

renganathan
2 Oct 2012, 8:38 PM
Instead of overriding the methods when you create an instance, why not extend the checkbox selection model and use that new class in your grid?

can you give some example to how to do that?