View Full Version : Question on understanding Ext.override

3 Dec 2010, 8:59 PM
Howdy all,

I've used the override Condor talks about in this post:


Using this override:

Ext.override(Ext.grid.GroupSummary, {
doGroupEnd : function(buf, g, cs, ds, colCount){
var data = this.calculate(g.rs, cs);
this.summaryData = data;
buf.push('</div>', this.renderSummary({data: data}, cs), '</div>');

Is it common, typical, standard, pick any one, for the override to get called twice?
I add some special sauce inside the override to add data to a store and I always
get duplicate data. If I just put a console.log in there it too is called twice.

If this will always be the case, is there a next best choice for an override that
will only be called once? I've looked through the source but it wasn't obvious
without a lot of trial and error.


3 Dec 2010, 11:50 PM
Overriding a method simply replaces the original method of the class with the one you specified.

How many times the method is called has nothing to do with if it is overridden or not, but with how the original class uses the method.

doGroupEnd is called every time the end of a group needs to be rendered, so it is going to be called once for every group in the store. And when the grid is refreshed (e.g. by sorting) it will be called again for each group.

9 Dec 2010, 8:33 PM
Excellent, thanks for the info Condor. ddGroupEnd was getting called more than I thought it should have been because I wasn't taking the sorting into consideration. Appreciate the info.