PDA

View Full Version : Clarification on summaryRenderer function on grid columns



bharadwaj_divya
12 Dec 2014, 5:42 AM
Hi ExtJS Experts,

I am very new to ExtJS. Can somebody explain the difference between


summaryRender: function (value, summaryData, dataIndex) and
summaryRender: function (value, metaData, data )

when i use the first implementation it executes as the second implementation.
Now, i have problem in obtaining the summaryData.

and one more thing, is there any way to get summaryData in the

summaryRender: function (value, metaData, data ) implementation.

this would help me to great extent.

Thank you in advance.

lumberjack
15 Dec 2014, 10:44 AM
Per the documentation (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.feature.Summary) for the Ext.grid.feature.Summary class:


Similar to a column, the summary also supports a summaryRenderer function. This summaryRenderer is called before displaying a value. The function is optional, if not specified the default calculated value is shown. The summaryRenderer is called with:

value {Object} - The calculated value.
summaryData {Object} - Contains all raw summary values for the row.
field {String} - The name of the field we are calculating
Regards,
Brian

bharadwaj_divya
15 Dec 2014, 9:56 PM
Hi Brian,

I am not able to use that function. When i use this method signature as you had mentioned, instead of summaryData I'm getting metadata object.

So, only I have an issue. Can you please help me with this.


Regards,
Bharadwaj GK

lumberjack
16 Dec 2014, 6:45 AM
What are you expecting the output to be for summaryData?

I've set up this fiddle so you can see what the output of the summaryRenderer variables are on the first column.

Regards,
Brian

https://fiddle.sencha.com/#fiddle/f5o
f5o

bharadwaj_divya
16 Dec 2014, 10:52 PM
Hi Brian,

I am using ExtJS 4.2.2 where I'm not getting the summaryData object. It gives me metaData object
I mean it is not the same object as it returns for different versions. You can have a look into it for below version that i have tested.

This summaryData is available in other versions i.e. I have tested for Exts 4.0.7 as well as 5.0.0.736, it is working perfectly.

Below is the link for what i am trying to achieve. I need a tooltip display on every summary row with
Total hrs: xx Hrs, Avg Hrs: xx Hrs and Service Hrs: xx Hrs as it displayed in the summary row.
https://fiddle.sencha.com/#fiddle/f6v

Now i have a problem with getting summaryData on current version that I'm using and displaying tool tip with summaryData.

Is there any workaround with same version to get summaryData object and somehow use particular data to show on tool tip on every summary row.

Please help me with this issue that I'm facing.

Thank you very much for your support and expecting a help from you to solve this issue.
(https://fiddle.sencha.com/#fiddle/f6v)

lumberjack
17 Dec 2014, 5:33 AM
This appears to have been a regression that occurred in the 4.1 branch that carried over into the earlier 4.2 releases. The summaryData object is being properly displayed in the Ext JS 4.2.3 release. Please upgrade to 4.2.3 to receive the proper summaryRenderer signature.

Regards,
Brian

vieniava
23 Jul 2015, 11:50 PM
Hello Brian,

You attached Fiddle https://fiddle.sencha.com/#fiddle/f5o
and it shows key names i.e:
gridcolumn-1011: an so on. It looks freaky (generated) and I can not relay on those names.

Is there any way to access summaryData by columnName or data index.

For me the bes way will be:
summaryData.get('student') - returns 4,
summaryData.get('mark') returns 80


Thanks for any suggestions

52911.