View Full Version : [DUPE-1073] GroupSummary invokes renderer without scope.

8 Oct 2010, 4:31 AM
Ext version tested:

Ext 3.2.1

Adapter used:


css used:

only default ext-all.css

Browser versions tested against:

Chromium 7
FF3 (firebug installed)

Operating System:

Ubuntu 10.04


GroupSummary does not invoke renderers the same way they are invoked in GridView. This makes it impossible to access the right scope inside the renderer function.

Test Case:
The following renderer will display the dataIndex for every row except for the summary row, where it will be empty (undefined).

var testRenderer = function(value, metadata, record) {
return this.dataIndex;

columns: [
{dataIndex: "testField", header: "test", summaryType: "sum", renderer: testRenderer}

The result that was expected:

column's scope is available inside the renderer.
All rows print the dataIndex in the cell value, including the summary.

The result that occurs instead:

There is no way to access column's scope.
All rows print the dataIndex in the cell value, but not in the summary.

Possible fix:
Based on GridView renderer invokation (doRender).
This works for me:

renderSummary : function(o, cs){
cs = cs || this.view.getColumnData();
var cfg = this.grid.getColumnModel().config,
buf = [], c, p = {}, cf, last = cs.length-1;
for(var i = 0, len = cs.length; i < len; i++){
c = cs[i];
cf = cfg[i];
p.id = c.id;
p.style = c.style;
p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
if(cf.summaryType || cf.summaryRenderer){
p.value = (cf.summaryRenderer || c.renderer).call(c.scope,o.data[c.name], p, o);
p.value = '';
if(p.value == undefined || p.value === "") p.value = " ";
buf[buf.length] = this.cellTpl.apply(p);

return this.rowTpl.apply({
tstyle: 'width:'+this.view.getTotalWidth()+';',
cells: buf.join('')

8 Oct 2010, 4:35 AM
Somebody, please, edit the tags in this thread. I wanted to add "grid,grouping,summary,renderer", but forgot that they had to be separated by commas (now I understand why it complained about a too long tag :P).

8 Oct 2010, 4:43 AM
This is a duplicate of this feature request (http://www.sencha.com/forum/showthread.php?102132-OPEN-1073-Sync-GroupSummary-with-GridView-changes).

8 Oct 2010, 5:14 AM
You are right.
Only that I'm not sure. I think that what you requested is actually a different thing, since you have access to the metadata object anyway, am I wrong? So you only need to add your fix to the init method to get it working, isn't it?
But you, indeed, provided a fix for this problem as well. Even though, it didn't affect you and you didn't mention it.

8 Oct 2010, 5:20 AM
My patch also covers it, because renderer scope was only recently added to GridView and GroupSummary wasn't updated to do the same.

8 Oct 2010, 5:27 AM
Yes, I thought I had said that your patch covers it.
In fact your patch is a lot better than mine, since it also covers some other renderer's features.

15 Oct 2010, 11:36 AM
Marking this thread as Dupe: http://www.sencha.com/forum/showthread.php?102132-OPEN-1073-Sync-GroupSummary-with-GridView-changes