PDA

View Full Version : Get sum of elements in group of group store



strimp099
14 Nov 2010, 1:07 PM
Hi all,

I want to apply a CSS gradient to a cell in a grid depending of its value compared to the sum of it's group. I use a custom renderer in my grouping store to format the CSS of the text itself and would like to use the same function to create the gradient.

My question is how one might return the sum of elements in a column within a group in a renderer.

Condor
14 Nov 2010, 4:25 PM
You'll almost have to do everything yourself. The renderer gets passed the rowIndex and the store as paramters. You will need to use this to determine what the first and last records in the current group are and calculate the sum.

strimp099
17 Nov 2010, 9:13 AM
Thanks for the reply. I ended up doing the calculations on the server side and passing a hidden column to the grid. Then I used the store object (with TONS of help from Firebug console.log) passed to the renderer function to find the value I was looking for.