-
17 Mar 2012 6:04 AM #1
GroupingView always reloads items on groupBy
GroupingView always reloads items on groupBy
What do you think about following listing?
It allows me to set groupingColumn before Attach event.
Also there are 2 issues with sorting in the original GroupingView:
1. If Loader.remoteSort = false then I can't use eintities withoun Comparable interface implementation.
2. If Loader.remoteSort = true then view will always load data from server automatically.
Code:public class MyGroupingView<T> extends GroupingView<T> { public MyGroupingView() { super(); } public MyGroupingView( com.sencha.gxt.widget.core.client.grid.GroupingView.GroupingViewAppearance groupAppearance) { super(groupAppearance); } @Override public void groupBy(ColumnConfig<T, ?> column) { groupBy(column, true); } public void groupBy(ColumnConfig<T, ?> column, boolean refresh) { if (column != groupingColumn) { // set the new one groupingColumn = column; if (refresh && column == null) { // full redraw without groups refresh(false); } } } }
-
17 Mar 2012 6:33 AM #2
In order to group items, they must be sorted so the items in the same group are near each other - if the server is to be responsible for sorting, then it should to this work.
That said, there is a change in SVN (and will be available in the next release) that allows for a custom Comparator to be defined for any ColumnConfig. And of course remember that a ColumnConfig that uses a child property and groups on that item doesn't need the entire entity to be Comparable, as it will only use that property to sort. The example at http://staging.sencha.com:8080/examp...vegroupsummary shows what the code, example looks like after this change.
Thanks for the patch allowing GroupingView.groupBy to be called earlier - we have made a similar change in SVN already, but I will compare it with yours to see if it adds any additionally useful features.


Reply With Quote