PDA

View Full Version : Ext.selection.Model does not support allowDeselect when mode === 'MULTI'



shanonvl
17 May 2011, 12:47 PM
I'm not sure if this is by-design, but after looking at the allowDeselect property API doc:



/**
* @cfg {Boolean} allowDeselect
* Allow users to deselect a record in a DataView, List or Grid. Only applicable when the SelectionModel's mode is 'SINGLE'. Defaults to false.
*/
allowDeselect: false,


I'm not sure why you would not support this property when mode === 'MULTI' ?

I have a usecase when I want simpleSelect === true && mode === 'MULTI' && allowDeselect === false...

I've worked around this by specifying my own DataViewModel in my dataview's initComponent which fixes the problem, but I'm wondering why this functionality was implemented in this manner.



initComponent:function() {

/**
* dataviewmodel DOES NOT support allowDeselect property when mode === 'MULTI',
* we override the default doDeselect function to take it into account.
*/
this.selModel = Ext.create('Ext.selection.DataViewModel',{
mode:'MULTI',
allowDeselect:false,
doDeselect:function() {
if( this.allowDeselect ) {
this.callParent(arguments);
}
}
});

this.callParent(arguments);

}


Thanks,
Shanon