PDA

View Full Version : How to group on group value, but sort on rendered value?



dbassett74
23 Sep 2009, 3:05 PM
I'm utilizing the GroupingView and have run into a slight problem. I will try to make this as clear as possible.

1) We are loading the grid with a list of "contacts". In each contact, is identified a "parentId".

2) We are grouping on the "parentId".

3) In the groupRenderer, we are using the parentId in order to retrieve some additional info about the parent, that will be displayed in the group header.

But because the GroupingView is apparently sorting off the "parentId", which is just a random number, and we are displaying a different value in the header, it's not sorted correctly.

I know that we could simply add the "additional info" for the parent within the list of "contacts", but this would mean a lot of duplication. We prefer the approach we are taking, which is just to include the parent id, and only grabbing the additional info at render.

So, is there a way to group on one value, but sort on the other value at render time?

27 Sep 2009, 6:18 PM
you should probably consider sorting on the server side. The custom renderers should be ast light as possible to have the best performance as possible.

Animal
27 Sep 2009, 10:11 PM
http://www.extjs.com/deploy/dev/docs/?class=Ext.data.Field&member=sortType

dbassett74
28 Sep 2009, 6:00 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.data.Field&member=sortType

oh, that's pretty cool and can definitely come in handy. For example, when having a grid that acts as a file manager, where you have files and folders in the grid, but when sorting on the name column, need to keep the files and folders grouped together (assuming not using GroupingView). Thanks.