title: Why my grid does not move on second page with paging toolbar(GWT 2.4)?
body: <p>I am developing a GWT app where I am using paging toolbar. When I have more than 10 groups in grid, user can go to second page with paging toolbar. But when I press button to go to the second page, it goes to that second, loading is shown but then toolbar is back to the first page with those first. 10 items. 
  This is first page:
  <a href="https://i.stack.imgur.com/WCzOP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WCzOP.png" alt="enter image description here"></a></p>
  
  <p>And when I press button for second page I get this loading:</p>
  
  <p><a href="https://i.stack.imgur.com/mNHfq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mNHfq.png" alt="enter image description here"></a></p>
  
  <p>But then after that toolbar backs me to the first page. This is my class for paging toolbar:</p>
  
  <pre><code>public class MyPagingToolBar extends PagingToolBar {
  
      private static final ConsoleMessages MSGS = GWT.create(ConsoleMessages.class);
  
      public MyPagingToolBar(int pageSize) {
          super(pageSize);
  
          PagingToolBarMessages pagingToolbarMessages = getMessages();
          pagingToolbarMessages.setBeforePageText(MSGS.pagingToolbarPage());
          pagingToolbarMessages.setAfterPageText(MSGS.pagingToolbarOf().concat("{0}"));
  
          StringBuilder sb = new StringBuilder();
          sb.append(MSGS.pagingToolbarShowingPre())
                  .append(" {0} - {1} ")
                  .append(MSGS.pagingToolbarShowingMid())
                  .append(" {2} ")
                  .append(MSGS.pagingToolbarShowingPost());
          pagingToolbarMessages.setDisplayMsg(sb.toString());
  
          pagingToolbarMessages.setEmptyMsg(MSGS.pagingToolbarNoResult());
  
          pagingToolbarMessages.setFirstText(MSGS.pagingToolbarFirstPage());
          pagingToolbarMessages.setPrevText(MSGS.pagingToolbarPrevPage());
          pagingToolbarMessages.setNextText(MSGS.pagingToolbarNextPage());
          pagingToolbarMessages.setLastText(MSGS.pagingToolbarLastPage());
          pagingToolbarMessages.setRefreshText(MSGS.pagingToolbarRefresh());
      }
  }
  </code></pre>
  
  <p>And this is class where I using MyPagingToolbar:</p>
  
  <pre><code>public abstract class EntityGrid&lt;M extends GwtEntityModel&gt; extends ContentPanel {
  
      private static final ConsoleMessages MSGS = GWT.create(ConsoleMessages.class);
  
      private static final int ENTITY_PAGE_SIZE = 10;
  
      protected GwtSession currentSession;
      private AbstractEntityView&lt;M&gt; parentEntityView;
  
      private EntityCRUDToolbar&lt;M&gt; entityCRUDToolbar;
      protected KapuaGrid&lt;M&gt; entityGrid;
      protected BasePagingLoader&lt;PagingLoadResult&lt;M&gt;&gt; entityLoader;
      protected ListStore&lt;M&gt; entityStore;
      protected PagingToolBar entityPagingToolbar;
      protected EntityFilterPanel&lt;M&gt; filterPanel;
  
      protected EntityGrid(AbstractEntityView&lt;M&gt; entityView, GwtSession currentSession) {
          super(new FitLayout());
          //
          // Set other properties
          this.parentEntityView = entityView;
          this.currentSession = currentSession;
  
          //
          // Container borders
          setBorders(false);
          setBodyBorder(true);
          setHeaderVisible(false);
  
          //
          // CRUD toolbar
          entityCRUDToolbar = getToolbar();
          if (entityCRUDToolbar != null) {
              setTopComponent(entityCRUDToolbar);
          }
          //
          // Paging toolbar
          entityPagingToolbar = getPagingToolbar();
          if (entityPagingToolbar != null) {
              setBottomComponent(entityPagingToolbar);
          }
      }
  
      @Override
      protected void onRender(Element target, int index) {
          super.onRender(target, index);
  
          //
          // Configure Entity Grid
  
          // Data Proxy
          RpcProxy&lt;PagingLoadResult&lt;M&gt;&gt; dataProxy = getDataProxy();
  
          // Data Loader
          entityLoader = new BasePagingLoader&lt;PagingLoadResult&lt;M&gt;&gt;(dataProxy);
  
          // Data Store
          entityStore = new ListStore&lt;M&gt;(entityLoader);
  
          //
          // Grid Data Load Listener
          entityLoader.addLoadListener(new EntityGridLoadListener&lt;M&gt;(this, entityStore));
  
          //
          // Bind Entity Paging Toolbar
          if (entityPagingToolbar != null) {
              entityPagingToolbar.bind(entityLoader);
          }
  
          //
          // Configure columns
          ColumnModel columnModel = new ColumnModel(getColumns());
  
          //
          // Set grid
          entityGrid = new KapuaGrid&lt;M&gt;(entityStore, columnModel);
          add(entityGrid);
  
          //
          // Bind the grid to CRUD toolbar
          entityCRUDToolbar.setEntityGrid(this);
  
          //
          // Grid selection mode
          GridSelectionModel&lt;M&gt; selectionModel = entityGrid.getSelectionModel();
          selectionModel.setSelectionMode(SelectionMode.SINGLE);
          selectionModel.addSelectionChangedListener(new SelectionChangedListener&lt;M&gt;() {
  
              @Override
              public void selectionChanged(SelectionChangedEvent&lt;M&gt; se) {
                  selectionChangedEvent(se.getSelectedItem());
              }
          });
  
          //
          // Grid view options
          GridView gridView = entityGrid.getView();
          gridView.setEmptyText(MSGS.gridEmptyResult());
  
          //
          // Do first load
          refresh();
      }
  
      protected EntityCRUDToolbar&lt;M&gt; getToolbar() {
          return new EntityCRUDToolbar&lt;M&gt;(currentSession);
      }
  
      protected abstract RpcProxy&lt;PagingLoadResult&lt;M&gt;&gt; getDataProxy();
  
      protected PagingToolBar getPagingToolbar() {
          return new MyPagingToolBar(ENTITY_PAGE_SIZE);
      }
  
      protected abstract List&lt;ColumnConfig&gt; getColumns();
  
      public void refresh() {
          entityLoader.load();
          entityPagingToolbar.enable();
      }
  
      public void refresh(GwtQuery query) {
          // m_filterPredicates = predicates;
          setFilterQuery(query);
          entityLoader.load();
          entityPagingToolbar.enable();
      }
  
      public void setFilterPanel(EntityFilterPanel&lt;M&gt; filterPanel) {
          this.filterPanel = filterPanel;
          entityCRUDToolbar.setFilterPanel(filterPanel);
      }
  
      protected void selectionChangedEvent(M selectedItem) {
          if (parentEntityView != null) {
              parentEntityView.setSelectedEntity(selectedItem);
          }
      }
  
      public void setPagingToolbar(PagingToolBar entityPagingToolbar) {
          this.entityPagingToolbar = entityPagingToolbar;
      }
  
      public GridSelectionModel&lt;M&gt; getSelectionModel() {
          return entityGrid.getSelectionModel();
      }
  
      protected abstract GwtQuery getFilterQuery();
  
      protected abstract void setFilterQuery(GwtQuery filterQuery);
  </code></pre>
  
  <p>What is my mistake?</p>
  
  <p>EDIT: This is my server method:</p>
  
  <pre><code>int totalLength = 0;
          List&lt;GwtGroup&gt; gwtGroupList = new ArrayList&lt;GwtGroup&gt;();
          try {
              KapuaLocator locator = KapuaLocator.getInstance();
              GroupService groupService = locator.getService(GroupService.class);
              UserService userService = locator.getService(UserService.class);
              GroupQuery groupQuery = GwtKapuaAuthorizationModelConverter.convertGroupQuery(loadConfig,
                      gwtGroupQuery);
              GroupListResult groups = groupService.query(groupQuery);
              if (!groups.isEmpty()) {
                  if (groups.getSize() &gt;= loadConfig.getLimit()) {
                      totalLength = Long.valueOf(groupService.count(groupQuery)).intValue();
  
                  } else {
                      totalLength = groups.getSize();
                  }
                  for (Group g : groups.getItems()) {
                      gwtGroupList.add(KapuaGwtAuthorizationModelConverter.convertGroup(g));
                      for (GwtGroup gwtGroup : gwtGroupList) {
                          User user = userService.find(g.getScopeId(), g.getCreatedBy());
                          if (user != null) {
                              gwtGroup.setUserName(user.getDisplayName());
                          }
                  }
              }
              }
          } catch (Exception e) {
              KapuaExceptionHandler.handle(e);
          }
          return new BasePagingLoadResult&lt;GwtGroup&gt;(gwtGroupList, loadConfig.getOffset(),
                  totalLength);
      }
  </code></pre>