com.extjs.gxt.ui.client.widget.grid.filters
Class GridFilters

java.lang.Object
  extended by com.extjs.gxt.ui.client.widget.grid.filters.GridFilters
All Implemented Interfaces:
ComponentPlugin

public class GridFilters
extends java.lang.Object
implements ComponentPlugin

GridFilter is a plugin for grids that allow for a slightly more robust representation of filtering than what is provided by the default store.

Filtering is adjusted by the user using the grid's column header menu (this menu can be disabled through configuration). Through this menu users can configure, enable, and disable filters for each column.


Nested Class Summary
static class GridFilters.GridFiltersMessages
           
 
Field Summary
protected  Grid<ModelData> grid
           
 
Constructor Summary
GridFilters()
           
 
Method Summary
 void addFilter(Filter filter)
          Adds the given filter.
protected  void bindStore(ListStore<ModelData> store, boolean initial)
           
 java.util.List<FilterConfig> buildQuery(java.util.List<Filter> filters)
          Function to take the active filters data and build it into a query.
 void cleanParams(FilterPagingLoadConfig config)
          Removes filter related query parameters from the provided object.
 void clearFilters()
          Turns all filters off.
 Filter getFilter(java.lang.String dataIndex)
           
 java.util.List<Filter> getFilterData()
          Returns a list of the currently active filters.
protected  Filter getMenuFilter(MenuEvent me)
           
 GridFilters.GridFiltersMessages getMessages()
           
protected  StoreFilter<ModelData> getModelFilter()
           
 int getUpdateBuffer()
          Returns the number of milliseconds to defer store updates.
 void init(Component component)
          Initializes the plugin when the component is created.
 boolean isAutoReload()
          Returns true if auto load is enabled.
 boolean isLocal()
          Returns true if local filtering is enabled.
protected  void onBeforeCheck(MenuEvent me)
           
protected  void onBeforeLoad(LoadEvent le)
           
protected  void onCheckChange(MenuEvent me)
           
protected  void onContextMenu(GridEvent be)
           
protected  void onLoad(LoadEvent le)
           
protected  void onReconfigure()
           
protected  void onStateChange(Filter filter)
           
protected  void reload()
           
 void removeAll()
          Removes all filters.
 void removeFilter(Filter filter)
          Removes the given filter.
protected  void saveState(Grid grid, java.util.Map<java.lang.String,java.lang.Object> state)
           
 void setAutoReload(boolean autoLoad)
          Tree to reload the datasource when a filter change happens (defaults to true).
 void setLocal(boolean local)
          True to use Store filter functions (local filtering) instead of the default server side filtering (defaults to false).
 void setMessages(GridFilters.GridFiltersMessages messages)
           
 void setUpdateBuffer(int updateBuffer)
          Number of milliseconds to defer store updates since the last filter change (defaults to 500).
 void updateColumnHeadings()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

grid

protected Grid<ModelData> grid
Constructor Detail

GridFilters

public GridFilters()
Method Detail

addFilter

public void addFilter(Filter filter)
Adds the given filter.

Parameters:
filter - the filter to be added

buildQuery

public java.util.List<FilterConfig> buildQuery(java.util.List<Filter> filters)
Function to take the active filters data and build it into a query.

Parameters:
filters - the active filters
Returns:
the list of filter configs

cleanParams

public void cleanParams(FilterPagingLoadConfig config)
Removes filter related query parameters from the provided object.

Parameters:
config - the load config

clearFilters

public void clearFilters()
Turns all filters off. This does not clear the configuration information (see removeAll()).


getFilter

public Filter getFilter(java.lang.String dataIndex)

getFilterData

public java.util.List<Filter> getFilterData()
Returns a list of the currently active filters.

Returns:
the list of active filters

getMessages

public GridFilters.GridFiltersMessages getMessages()

getUpdateBuffer

public int getUpdateBuffer()
Returns the number of milliseconds to defer store updates.

Returns:
the update buffer

init

public void init(Component component)
Description copied from interface: ComponentPlugin
Initializes the plugin when the component is created.

Specified by:
init in interface ComponentPlugin
Parameters:
component - the source component

isAutoReload

public boolean isAutoReload()
Returns true if auto load is enabled.

Returns:
the auto load state

isLocal

public boolean isLocal()
Returns true if local filtering is enabled.

Returns:
true for local

removeAll

public void removeAll()
Removes all filters.


removeFilter

public void removeFilter(Filter filter)
Removes the given filter.

Parameters:
filter - the filter to be removed

setAutoReload

public void setAutoReload(boolean autoLoad)
Tree to reload the datasource when a filter change happens (defaults to true). Set this to false to prevent the datastore from being reloaded if there are changes to the filters.

Parameters:
autoLoad - true to enable auto reload

setLocal

public void setLocal(boolean local)
True to use Store filter functions (local filtering) instead of the default server side filtering (defaults to false).

Parameters:
local - true for local

setMessages

public void setMessages(GridFilters.GridFiltersMessages messages)

setUpdateBuffer

public void setUpdateBuffer(int updateBuffer)
Number of milliseconds to defer store updates since the last filter change (defaults to 500).

Parameters:
updateBuffer - the buffer in milliseconds

updateColumnHeadings

public void updateColumnHeadings()

bindStore

protected void bindStore(ListStore<ModelData> store,
                         boolean initial)

getMenuFilter

protected Filter getMenuFilter(MenuEvent me)

getModelFilter

protected StoreFilter<ModelData> getModelFilter()

onBeforeCheck

protected void onBeforeCheck(MenuEvent me)

onBeforeLoad

protected void onBeforeLoad(LoadEvent le)

onCheckChange

protected void onCheckChange(MenuEvent me)

onContextMenu

protected void onContextMenu(GridEvent be)

onLoad

protected void onLoad(LoadEvent le)

onReconfigure

protected void onReconfigure()

onStateChange

protected void onStateChange(Filter filter)

reload

protected void reload()

saveState

protected void saveState(Grid grid,
                         java.util.Map<java.lang.String,java.lang.Object> state)