com.extjs.gxt.ui.client.store
Class GroupingStore<M extends ModelData>

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.store.Store<M>
          extended by com.extjs.gxt.ui.client.store.ListStore<M>
              extended by com.extjs.gxt.ui.client.store.GroupingStore<M>
Type Parameters:
M - the model type
All Implemented Interfaces:
Observable

public class GroupingStore<M extends ModelData>
extends ListStore<M>

A specialized store implementation that provides for grouping models by one of the available fields.


Field Summary
 
Fields inherited from class com.extjs.gxt.ui.client.store.ListStore
config, loader
 
Fields inherited from class com.extjs.gxt.ui.client.store.Store
Add, all, BeforeAdd, BeforeClear, BeforeDataChanged, BeforeRemove, BeforeSort, Clear, DataChanged, Filter, filterBeginsWith, filtered, filterProperty, filters, filtersEnabled, modified, recordMap, Remove, snapshot, Sort, sortInfo, storeSorter, Update
 
Constructor Summary
GroupingStore()
          Creates a new grouping store.
GroupingStore(ListLoader loader)
          Creates a new grouping store.
 
Method Summary
protected  boolean applyGrouping(boolean alwaysFireChange)
           
protected  void applySort(boolean supressEvent)
           
 void clearGrouping()
          Clears any existing grouping and refreshes the data using the default sort.
 java.lang.String getGroupState()
          Returns the group state.
 void groupBy(java.lang.String field)
          Groups the data by the specified field.
 void groupBy(java.lang.String field, boolean forceRegroup)
          Groups the data by the specified field.
 boolean isGroupOnSort()
          Returns true if group on sort is enabled.
 boolean isRemoteGroup()
          Returns true if remote grouping is enabled.
 void setGroupOnSort(boolean groupOnSort)
          True to sort the data on the grouping field when a grouping operation occurs, false to sort based on the existing sort info (defaults to false).
 void setRemoteGroup(boolean remoteGroup)
          True if the grouping should apply on the server side, false if it is local only (defaults to false).
 
Methods inherited from class com.extjs.gxt.ui.client.store.ListStore
add, add, fireStoreEvent, getAt, getCount, getLoadConfig, getLoader, getRange, getSortDir, getSortField, getSortState, indexOf, insert, insert, insert, onBeforeLoad, onLoad, onLoadException, remove, remove, setDefaultSort, setSortDir, setSortField, sort, sortData
 
Methods inherited from class com.extjs.gxt.ui.client.store.Store
addFilter, addStoreListener, afterCommit, afterEdit, afterReject, applyFilters, clearFilters, commitChanges, contains, createStoreEvent, equals, filter, filter, findModel, findModel, findModel, findModels, getFilters, getKeyProvider, getModelComparer, getModels, getModifiedRecords, getRecord, getStoreSorter, hasRecord, isFiltered, isFiltered, isMonitorChanges, onModelChange, registerModel, rejectChanges, removeAll, removeFilter, removeStoreListener, setKeyProvider, setModelComparer, setMonitorChanges, setStoreSorter, swapModelInstance, unregisterModel, update
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupingStore

public GroupingStore()
Creates a new grouping store.


GroupingStore

public GroupingStore(ListLoader loader)
Creates a new grouping store.

Parameters:
loader - the list loader
Method Detail

clearGrouping

public void clearGrouping()
Clears any existing grouping and refreshes the data using the default sort.


getGroupState

public java.lang.String getGroupState()
Returns the group state.

Returns:
the state

groupBy

public void groupBy(java.lang.String field)
Groups the data by the specified field.

Parameters:
field - the field name by which to group by

groupBy

public void groupBy(java.lang.String field,
                    boolean forceRegroup)
Groups the data by the specified field.

Parameters:
field - the field name by which to group by
forceRegroup - true to force the group to be refreshed even if the field passed in is the same as the current grouping field, false to skip grouping on the same field

isGroupOnSort

public boolean isGroupOnSort()
Returns true if group on sort is enabled.

Returns:
true for group on sort

isRemoteGroup

public boolean isRemoteGroup()
Returns true if remote grouping is enabled.

Returns:
true for remote grouping

setGroupOnSort

public void setGroupOnSort(boolean groupOnSort)
True to sort the data on the grouping field when a grouping operation occurs, false to sort based on the existing sort info (defaults to false).

Parameters:
groupOnSort - true to group on sort

setRemoteGroup

public void setRemoteGroup(boolean remoteGroup)
True if the grouping should apply on the server side, false if it is local only (defaults to false). If the grouping is local, it can be applied immediately to the data. For remote grouping, the store requires a list loader.

Parameters:
remoteGroup - true to enable remote grouping

applyGrouping

protected boolean applyGrouping(boolean alwaysFireChange)

applySort

protected void applySort(boolean supressEvent)
Overrides:
applySort in class ListStore<M extends ModelData>