Package com.extjs.gxt.ui.client.data

Examples of com.extjs.gxt.ui.client.data.SortInfo


    }

    if (remoteGroup) {
      loader.load(config);
    } else {
      SortInfo se = sortInfo != null ? sortInfo : new SortInfo();
      if (se.getSortField() != null && !se.getSortField().equals(field)) {
        applySort(false);
      } else {
        sortData(field, null);
      }
      fireEvent(DataChanged, createStoreEvent());
View Full Code Here


   *
   * @param field the name of the field to sort by
   * @param dir the sort direction
   */
  public void setDefaultSort(String field, SortDir dir) {
    sortInfo = new SortInfo(field, dir);
  }
View Full Code Here

   */
  public void sort(String field, SortDir sortDir) {
    if (!fireEvent(BeforeSort, createStoreEvent())) {
      return;
    }
    SortInfo prev = new SortInfo(sortInfo.getSortField(), sortInfo.getSortDir());

    if (sortDir == null) {
      if (sortInfo.getSortField() != null && !sortInfo.getSortField().equals(field)) {
        sortInfo.setSortDir(SortDir.NONE);
      }
      switch (sortInfo.getSortDir()) {
        case ASC:
          sortDir = SortDir.DESC;
          break;
        case DESC:
        case NONE:
          sortDir = SortDir.ASC;
          break;
      }

    }

    sortInfo.setSortField(field);
    sortInfo.setSortDir(sortDir);

    if (loader != null && loader.isRemoteSort()) {
      Listener<LoadEvent> l = new Listener<LoadEvent>() {
        public void handleEvent(LoadEvent le) {
          loader.removeListener(Loader.Load, this);
          sortInfo = le.<ListLoadConfig> getConfig().getSortInfo();
          fireEvent(Sort, createStoreEvent());
        }
      };
      loader.addListener(Loader.Load, l);
      loader.setSortDir(sortDir);
      loader.setSortField(field);
      if (!loader.load()) {
        loader.removeListener(Loader.Load, l);
        sortInfo.setSortField(prev.getSortField());
        sortInfo.setSortDir(prev.getSortDir());
      }
    } else {
      applySort(false);
      fireEvent(DataChanged, createStoreEvent());
    }
View Full Code Here

    if (le.<Object> getConfig() instanceof ListLoadConfig) {
      ListLoadConfig config = le.getConfig();
      if (config.getSortInfo().getSortField() != null) {
        sortInfo = config.getSortInfo();
      } else {
        sortInfo = new SortInfo();
      }
    }

    if (filtersEnabled) {
      filtersEnabled = false;
View Full Code Here

    templateOnColumnWidthUpdated(col, w, tw);
    syncHScroll();
  }

  protected void updateHeaderSortState() {
    SortInfo state = getSortState();
    if (state == null || state.getSortField() == null) {
      return;
    }
    if (sortState == null || (!sortState.getSortField().equals(state.getSortField()))
        || sortState.getSortDir() != state.getSortDir()) {
      GridEvent<ModelData> e = new GridEvent<ModelData>(grid);
      e.setSortInfo(state);

      sortState = new SortInfo(state.getSortField(), state.getSortDir());
      int sortColumn = cm.findColumnIndex(state.getSortField());
      if (sortColumn != -1) {
        updateSortIcon(sortColumn, sortState.getSortDir());
      }
      if (grid.isStateful()) {
        Map<String, Object> st = grid.getState();
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.data.SortInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.