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

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


    if (config != null && config.getSortInfo() != null
        && !Util.isEmptyString(config.getSortInfo().getSortField())) {
      sortInfo = config.getSortInfo();
    } else {
      sortInfo = new SortInfo();
    }

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


    }

    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

   * @param field the field to sort by
   * @param sortDir the sort dir
   */
  public void sort(String field, SortDir sortDir) {
    final StoreEvent<M> event = createStoreEvent();
    event.setSortInfo(new SortInfo(field, sortDir));

    if (!fireEvent(BeforeSort, event)) {
      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);
          event.setSortInfo(sortInfo);
          fireEvent(Sort, event);
        }
      };
      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, event);
    }
View Full Code Here

    }

    if (config != null && config.getSortInfo() != null && !Util.isEmptyString(config.getSortInfo().getSortField())) {
      sortInfo = config.getSortInfo();
    } else {
      sortInfo = new SortInfo();
    }

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

   * @param sortDir the sort dir
   */
  @SuppressWarnings("rawtypes")
  public void sort(String field, SortDir sortDir) {
    final StoreEvent<M> event = createStoreEvent();
    event.setSortInfo(new SortInfo(field, sortDir));

    if (!fireEvent(BeforeSort, event)) {
      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 instanceof RemoteSortTreeLoader) {
      final RemoteSortTreeLoader treeLoader = (RemoteSortTreeLoader) loader;
      if (treeLoader.isRemoteSort()) {
        Listener<LoadEvent> l = new Listener<LoadEvent>() {
          public void handleEvent(LoadEvent le) {
            treeLoader.removeListener(Loader.Load, this);
            sortInfo = le.<ListLoadConfig> getConfig().getSortInfo();
            event.setSortInfo(sortInfo);
            fireEvent(Sort, createStoreEvent());
          }
        };
        treeLoader.addListener(Loader.Load, l);
        treeLoader.setSortDir(sortDir);
        treeLoader.setSortField(field);
        if (!treeLoader.load()) {
          treeLoader.removeListener(Loader.Load, l);
          sortInfo.setSortField(prev.getSortField());
          sortInfo.setSortDir(prev.getSortDir());
        }
        return;
      }
    }

View Full Code Here

      if (obj != null && obj instanceof ListLoadConfig) {
        ListLoadConfig config = le.getConfig();
        if (config.getSortInfo().getSortField() != null) {
          sortInfo = config.getSortInfo();
        } else {
          sortInfo = new SortInfo();
        }
      }
      doInsert(rootWrapper, insert, 0, false, true);
      if (filtersEnabled) {
        filtersEnabled = false;
View Full Code Here

    syncHScroll();
  }

  @SuppressWarnings("unchecked")
  protected void updateHeaderSortState() {
    SortInfo state = getSortState();
    if (state == null || Util.isEmptyString(state.getSortField())) {
      return;
    }
    if (sortState == null || (!sortState.getSortField().equals(state.getSortField()))
        || sortState.getSortDir() != state.getSortDir()) {

      GridEvent<ModelData> e = (GridEvent<ModelData>) createComponentEvent(null);
      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

      }
      updateColumnWidth(i, cm.getColumnWidth(i));
    }
    if (container instanceof Grid) {
      Grid<?> grid = (Grid) container;
      SortInfo sortInfo = grid.getStore().getSortState();
      if (sortInfo != null && sortInfo.getSortField() != null) {
        updateSortIcon(grid.getColumnModel().findColumnIndex(sortInfo.getSortField()), sortInfo.getSortDir());
      }
    }
    cleanCells();
    if (isAttached()) {
      adjustHeights();
View Full Code Here

      }
      updateColumnWidth(i, cm.getColumnWidth(i));
    }
    if (container instanceof Grid) {
      Grid<?> grid = (Grid) container;
      SortInfo sortInfo = grid.getStore().getSortState();
      if (sortInfo != null && sortInfo.getSortField() != null) {
        updateSortIcon(grid.getColumnModel().findColumnIndex(sortInfo.getSortField()), sortInfo.getSortDir());
      }
    }
    cleanCells();
    if (isAttached()) {
      adjustHeights();
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.