PDA

View Full Version : Ext.grid.GroupingView -> toggleGroup-event



tobiu
2 Jan 2010, 12:51 PM
hi together,

this is just a small but helpful override:



/*
* 3.0.3 and 3.1.0
* adding the toggleGroup - event
*/
Ext.grid.GroupingView.override ({
toggleGroup : function(group, expanded){
var gel = Ext.get(group);
expanded = Ext.isDefined(expanded) ? expanded : gel.hasClass('x-grid-group-collapsed');
if(this.state[gel.id] !== expanded){
this.grid.stopEditing(true);
this.state[gel.id] = expanded;
gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');
this.fireEvent('toggleGroup', this, gel, expanded);
}
}
});


whenever you expand / collapse a group of your grid, you can determine the change including the params view, groupEl, expanded.

if i had access to the feature-requests-forum, i would post it there. feel free to move the topic or integrate it in svn.

example-usage: if you combine the Ext.ux.grid.RowEditor with a groupingView, you will notice, that the editor does not hide, when you collapse a group. this solves it:

grid-config


,view: new Ext.grid.GroupingView({
forceFit : true
,markDirty : false
,listeners : {
toggleGroup : function(view, group, expanded){
if(!expanded){
editor.stopEditing(false);
}
}
}
})


kind regards,
tobiu

Deminie
13 Oct 2011, 1:13 AM
Many thanks)) great work will not be pulling my hair out any more:D
It will take not a lot of time but brings great results