PDA

View Full Version : Summing data and displaying it in Grouping List



shizny
27 Sep 2011, 11:03 AM
Hello,

Could somebody give me a little info on how I might go about adding a summarized value to the header of a grouped list. For example. I have the model

{firstname, lastname}

and say 10 records.

I want to group by lastname, but while I group I'd like to keep track of the number of records in the current grouping and display that in the "Header" or "Group Header". Like this..

__________________
Thompson -- 3 Results
------------------------
David
Susan
Audrey
__________________
Smith -- 1 Result
------------------------
Cassy

I have to do this client-side and can not group or summarize on the server.

Thanks in advance.

MiamiCoder
28 Sep 2011, 1:31 PM
Take a look at the store's getGroups() function. It will give you the groups (array) and each group's children (array).

shizny
28 Sep 2011, 5:36 PM
Thank you, that was exactly what I was looking for.