PDA

View Full Version : On a grid is it possible to toggle between group summary and normal summary?



IlanCopelyn
5 Aug 2012, 5:04 PM
I have a grid which I would normally like to show ungrouped. I want a summary row to be displayed in this ungrouped view. I would also like to be able to switch to a grouped view and be able to show grouped summaries. I want to be able to toggle between the grouped and ungrouped views and have the appropriate summary row rendered.

This is proving a little tricky. If I just use the standard grouping summary feature I can toggle between normal (i.e. ungrouped) and grouped (with grouped summary). It looks like this:
http://demo.mysamplecode.com/ExtJs/pages/gridGroupSummary.jsp
(http://demo.mysamplecode.com/ExtJs/pages/gridGroupSummary.jsp)The problem is that there is no summary row in the normal (i.e ungrouped) view.

To address this I tried creating 2 summary features - one with
ftype: 'groupingsummary' and another with
ftype: 'summary' and enable()ing or disable()ing each one as appropriate.

This behaves a bit erratically. The normal summary row works on first load, but after toggle-ing to the grouped view and back to normal again, (calling enable() and disable() on each feature as appropriate) the normal summary row disappears. The grouping summary row works properly however. If I vary the order in which I enable() and disable() the grouping feature and the summary feature I can get strange behaviour like 2 summary rows appearing on the grouped view and no summary on the normal view.

Any thoughts?

IlanCopelyn
8 Aug 2012, 3:33 AM
Refreshing the view on the grid did the trick in the end.