PDA

View Full Version : Grouping feature events don't get triggered



Salah91
5 Mar 2012, 3:18 AM
Hi everyone!

I have an issue when using the grid grouping feature.
I'd like to catch the 'click' event so I added the listener like this :

var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{ groupHeaderTpl: 'Cuisine: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})',
listeners: {
'click': function() {
alert("test");
}
}

});

And I get this error in console :

Uncaught TypeError: Cannot read property 'click' of undefined

I used the sample code : http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/grid/groupgrid.html
The grouping feature works well, I just can't catch the events.

Any idea of what's going on ?
Thanks for your time.

Edit : Same issue with 'groupclick' and 'groupcollapse' events.

chramer
5 Mar 2012, 3:50 AM
Ext.grid.feature.Grouping doesn't have the 'click' event!
I think you need groupclick (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.feature.Grouping-event-groupclick)

Salah91
5 Mar 2012, 4:30 AM
Ext.grid.feature.Grouping doesn't have the 'click' event!
I think you need groupclick (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.feature.Grouping-event-groupclick)

You're right.
I'va tried 'groupclick' and 'groupcollapse' but it doesn't work either.

chramer
5 Mar 2012, 5:09 AM
it looks like this event is fired on the view
try this :

view : {
listeners: {
'groupclick': function() {
alert("test");
}
}

Salah91
5 Mar 2012, 6:39 AM
No error message this time but the listeners still dont get triggered :s

chramer
5 Mar 2012, 6:41 AM
try also to add this as a grid property!


viewConfig : {
listeners : {
'groupclick' : function() {
alert('success');
}
}
}

Salah91
5 Mar 2012, 6:44 AM
I finally found the answer. The events are fired on the grid as it's indicate in the documentation, I should have read it more carefully.

I juste added the 'groupclick' listener on the grid and it worked.

Thank you for your time chramer!

Edit : Seems you found it first :)