1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    24
    Vote Rating
    0
    bbg is on a distinguished road

      0  

    Exclamation 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);
                  }
            }
        }
    }

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    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.

Thread Participants: 1

Tags for this Thread