When I group items in a SPGridView using the GroupField property the grouping works great but the total row count does not show up like in a standard SharePoint list. Usually SharePoint will display the count next to the group in parenthesis (i.e. Group 1 (5)). Is there a way to enable this functionality.
Nope, that didn't do it. If DisplayGroupFieldName is true the grouping looks like "Group Field Name: Group 1". If DisplayGroupFieldName is false the grouping looks like "Group 1".
joegtp
2009-02-28 13:41:22
A:
I had a quick look at the code and even overriding the SPGridview does not seem to have an easy "hook" to override for this.
You may be able to create Javascript to do this, but it would be far from entertaining.
Nat
2009-03-02 02:25:10
A:
If you don't want to use javascript, you could iterate through the table and count the rows in each group.
The downside is that you would probably need to count all of the rows and then go back and update the group name in each row.
For example:
ID Value Group
1 One GroupA
2 Two GroupA
3 Three GroupB
4 Four GroupB
5 Five GroupB
2 in GroupA
3 in GroupB
ID Value Group
1 One GroupA (2)
2 Two GroupA (2)
3 Three GroupB (3)
4 Four GroupB (3)
5 Five GroupB (3)
Kit Menke
2009-04-30 21:46:27