View Full Version : Grid summaryRender Classes/Styles

2 Jul 2011, 5:03 PM

In Ext4, a regular grid cell's renderer function is passed a "metaData" object as the second argument. Modifying attributes on this such as "tdCls", "tdAttr" and "style" allows you to set a styles and attributes on the cell being rendered, which is great for doing formatting beyond the actual value itself, such as conditional formatting of cells based on cell values (e.g., showing red text for negative numbers and green for positive).

Back in Ext3, the details were slightly different but the capabilities to do this existed, and both regular-cell and summary-cell renderer functions worked the same way. Formatting functions were able to set styles on summary-row cells the same as regular cells (and in my case, I was actually using the exact same function for both regular-cell and summary-cell rendering).

However in Ext4 (tested in some early betas and now in 4.0.2a), this capability seems to have been removed - only 3 arguments are passed to summaryRenderer (as per the GroupingSummary feature) compared to the 7 passed to a regular cell's renderer. And none of the summaryRenderer's arguments (nor it's "this" scope object), seem to provide access back to the summary row's cell/TD.

I have read the documentation and inspected the summaryRenderer function arguments/"this" object in Firebug, but I can't see how to get the TD element for the cell being rendered in the summaryRenderer. Nor can I see a way of sending styles back to it through the summaryRenderer's return value. I considered sub-classing my own GroupingSummary class, but I'm not proficient enough yet in ExtJS to tackle that. Plus, it seems like a basic but useful feature that previously existed but has gotten lost (perhaps accidentally). So I thought I'd ask this helpful community whether it is intentional that cell and summary renderer functions are no longer consistent with each other and have lost this formatting capability, or whether this is a bug/regression. Or perhaps I've just missed the obvious, and this can be achieved in another way!

-- neverness

10 Jul 2011, 5:22 PM
So, anyone had any thoughts about whether the ExtJS 4.x summaryGrid renderer can get access to the actual element being rendered, or can provide styles or attributes, like how regular non-summary cell renderers can?

Since this seems like a regression or at least a change from ExtJS 3.3, I was hoping to get some confirmation from the community as to whether it was intentional before I considered logging it as a bug.

-- neverness