PDA

View Full Version : Grid-Grouping: groupcollapse & groupexpand events don't supply no arguments



suamikim
20 Jun 2012, 2:34 AM
Hi there,

I just discovered 2 things:

1.)
The groupcollapse- & groupexpand-events are not fired by the Grouping-feature itself (like it would have seemed to me because of the docu: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.feature.Grouping-event-groupcollapse (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.grid.feature.Grouping-event-groupcollapse)).
Acually it is fired by the view which can be seen in the Ext-Source. This alone wouldn't be a problem if one is aware of it...

2.)
The two mentioned events don't supply any helpful arguments. Actually they don't supply anything at all:
36368

Am i doing anything wrong here or is this a bug in Ext? Currently I'm working with version 4.0.2a.

Thanks

Example-Code:

Ext.onReady(function() {
var store = Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'email', 'sex'],
data: {'items':[
{ 'name': 'Lisa', 'email': 'lisa@c.com', 'sex': 'female' },
{ 'name': 'Bart', 'email': 'bart@a.com', 'sex': 'male' },
{ 'name': 'Homer', 'email': 'home@d.com', 'sex': 'male' },
{ 'name': 'Marge', 'email': 'marge@b.com', 'sex': 'female' }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
},
groupField: 'sex'
});

var grid = Ext.create('Ext.grid.Panel', {
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ header: 'Name', dataIndex: 'name' },
{ header: 'Email', dataIndex: 'email', flex: 1, field: 'textfield' }
],
features: [{ftype:'grouping'}],
hideHeaders: true
});

Ext.create('Ext.window.Window', {
width: 350,
height: 200,
layout: "fit",
items: grid
}).show();

grid.view.addListener('groupcollapse', function() {
console.warn(arguments);
}, this);

grid.view.addListener('groupexpand', function() {
console.warn(arguments);
}, this);
});

scottmartin
20 Jun 2012, 3:42 PM
Reference the params in the function themselves:



groupexpand( Ext.view.Table view, HTMLElement node, String group, Ext.EventObject e, Object eOpts )
groupcollapse( Ext.view.Table view, HTMLElement node, String group, Ext.EventObject e, Object eOpts )


Scott

suamikim
20 Jun 2012, 10:29 PM
I'm sorry but i'm not sure if i fully understand what you mean. Do you mean to explicitly put the parameters into my function-header like this:


grid.view.addListener('groupcollapse', function(view, node, group, e, eOpts) {
console.warn('view:', view, 'node:', node, 'group:', group, 'e:', e, 'eOpts:', eOpts);
}, this);

instead of


grid.view.addListener('groupcollapse', function() {
console.warn(arguments);
}, this);

If so, it's not working either. It outputs the following:

36410

Please let me know if this isn't what you meant...

Thanks

scottmartin
21 Jun 2012, 6:34 AM
See what you get if you use:

console.log(view);
console.log(node);

Scott.

suamikim
21 Jun 2012, 10:27 PM
And why should this be any different from my previous code with console.warn???

console.warn('view:', view, 'node:', node, 'group:', group, 'e:', e, 'eOpts:', eOpts);

Just for the sake of completeness, here's what i get:
36456

scottmartin
22 Jun 2012, 5:26 AM
Let me verify this as a bug and I will report back.

Scott.