com.smartgwt.client.data

## Class FilteredList

- java.lang.Object
- - com.smartgwt.client.core.BaseClass
  - - com.smartgwt.client.data.RecordList
    - - com.smartgwt.client.data.ResultSet
      - - com.smartgwt.client.data.FilteredList

- All Implemented Interfaces:
    com.google.gwt.event.shared.HasHandlers, HasDataArrivedHandlers, HasDataChangedHandlers

      public class FilteredList
      extends ResultSet

  A subclass of `ResultSet` designed to provide a synchronously filterable List interface for an array of data.

  Developers should set `allRows` to the full set of data objects, and use `criteria` to the apply criteria to the data set. Standard List APIs such as `List.get()`, `List.getLength()`, `List.getRange()`, etc will then allow access to a filtered subset of this data.

  The `dataSource` attribute may be used to specify the format of records to be stored within this list, but this is not required. If no DataSource is explicitly specified, filteredList will automatically generate its own DataSource with `dropUnknownCriteria` set to false.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.smartgwt.client.data.RecordList

      `RecordList.SortNormalizer`

  - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.data.RecordList

      `jsObj`

    - ### Fields inherited from class com.smartgwt.client.core.BaseClass

      `config, configOnly, factoryCreated, factoryProperties, id, scClassName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilteredList()`
    `FilteredList(com.google.gwt.core.client.JavaScriptObject jsObj)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.google.gwt.core.client.JavaScriptObject` | `create()`
    `Record[]` | `getAllRows()` Complete set of records for this filteredList.
    `DataSource` | `getDataSource()` Optional dataSource to specifying field names and types for records within this List.
    `boolean` | `getModifiable()` When true, allows the ResultSet to be modified by list APIs `List.addAt()`, `List.set()`, and `List.removeAt()`.
    `static FilteredList` | `getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `void` | `invalidateCache()` Invoking invalidateCache() will have no effect on a filteredList.
    `FilteredList` | `setAllRows(Record... allRows)` Complete set of records for this filteredList.
    `FilteredList` | `setDataSource(DataSource dataSource)` Optional dataSource to specifying field names and types for records within this List.
    `FilteredList` | `setModifiable(boolean modifiable)` When true, allows the ResultSet to be modified by list APIs `List.addAt()`, `List.set()`, and `List.removeAt()`.

    - ### Methods inherited from class com.smartgwt.client.data.ResultSet

      `addDataArrivedHandler, allMatchingRowsCached, allRowsCached, asSGWTComponent, compareCriteria, compareCriteria, dataArrived, ensureCreated, filterLocalData, find, find, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findByKey, findIndex, findIndex, findIndex, findIndex, findIndex, findIndex, findIndex, findNextIndex, findNextIndex, findNextIndex, findNextIndex, findNextIndex, findNextIndex, findNextIndex, findNextIndex, get, getAllCachedRows, getAllVisibleRows, getAlwaysRequestVisibleRows, getCriteria, getCriteriaPolicy, getDisableCacheSync, getDropCacheOnUpdate, getFetchDelay, getFetchMode, getFetchOperation, getLength, getLoadingMarker, getNeverDropUpdatedRows, getPaletteDefaults, getProgressiveLoading, getRange, getRangeAsRecordList, getRememberDynamicProgressiveLoading, getResultSize, getUpdateCacheFromRequest, getUpdatePartialCache, getUseClientFiltering, getUseClientSorting, getValueMap, indexOf, indexOf, isResultSet, lengthIsKnown, rangeIsLoaded, rowIsLoaded, setAlwaysRequestVisibleRows, setCriteria, setCriteriaPolicy, setDisableCacheSync, setDropCacheOnUpdate, setFetchDelay, setFetchMode, setFetchOperation, setInitialData, setInitialLength, setInitialSort, setNeverDropUpdatedRows, setProgressiveLoading, setRememberDynamicProgressiveLoading, setResultSize, setUpdateCacheFromRequest, setUpdatePartialCache, setUseClientFiltering, setUseClientSorting, usingFilteredData, willFetchData, willFetchData`

    - ### Methods inherited from class com.smartgwt.client.data.RecordList

      `add, addAt, addDataChangedHandler, addList, addList, addListAt, contains, contains, containsAll, duplicate, equals, find, find, find, find, findIndex, findNextIndex, findNextIndex, first, getItems, getJsObj, getOrCreateJsObj, getProperty, getRangeList, intersect, isARecordList, isCreated, isEmpty, last, lastIndexOf, lastIndexOf, remove, removeAt, removeList, set, setLength, setSort, sort, sort, sortByProperty, sortByProperty, toArray`

    - ### Methods inherited from class com.smartgwt.client.core.BaseClass

      `addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, clearDynamicProperty, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getRef, getRuleScope, getScClassName, getTestInstance, hasAutoAssignedID, hasDynamicProperty, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setID, setJavaScriptObject, setProperty, setProperty, setProperty, setProperty, setRuleScope, setScClassName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

      `fireEvent`

- - ### Constructor Detail

    - #### FilteredList

          public FilteredList()

    - #### FilteredList

          public FilteredList(com.google.gwt.core.client.JavaScriptObject jsObj)

  - ### Method Detail

    - #### getOrCreateRef

          public static FilteredList getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### create

          public com.google.gwt.core.client.JavaScriptObject create()

      Overrides:
        `create` in class `ResultSet`

    - #### setAllRows

          public FilteredList setAllRows(Record... allRows)
                                  throws java.lang.IllegalStateException

      Complete set of records for this filteredList. Sorting and filtering of this list will occur synchronously on the client.
      If this method is called after the component has been drawn/initialized: Updates `allRows` at run time.

      Note : This is an advanced setting

      Overrides:
        `setAllRows` in class `ResultSet`
      Parameters:
        `allRows` - New set of unfiltered cache data. Default value is []
      Returns:
        `FilteredList` instance, for chaining setter calls
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getAllRows

          public Record[] getAllRows()

      Complete set of records for this filteredList. Sorting and filtering of this list will occur synchronously on the client.
      Returns:
        Current allRows value. Default value is []

    - #### setDataSource

          public FilteredList setDataSource(DataSource dataSource)
                                     throws java.lang.IllegalStateException

      Optional dataSource to specifying field names and types for records within this List. Note that since a full data set should be provided to the list via `allRows`, this filteredList will not issue fetch requests against this DataSource.

      If no DataSource was explicitly specified, filteredList will automatically generate its own DataSource with `dropUnknownCriteria` set to false.

      Overrides:
        `setDataSource` in class `ResultSet`
      Parameters:
        `dataSource` - New dataSource value. Default value is null
      Returns:
        `FilteredList` instance, for chaining setter calls
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getDataSource

          public DataSource getDataSource()

      Optional dataSource to specifying field names and types for records within this List. Note that since a full data set should be provided to the list via `allRows`, this filteredList will not issue fetch requests against this DataSource.

      If no DataSource was explicitly specified, filteredList will automatically generate its own DataSource with `dropUnknownCriteria` set to false.

      Overrides:
        `getDataSource` in class `ResultSet`
      Returns:
        Current dataSource value. Default value is null

    - #### setModifiable

          public FilteredList setModifiable(boolean modifiable)

      When true, allows the ResultSet to be modified by list APIs `List.addAt()`, `List.set()`, and `List.removeAt()`. Only applies to `fetchMode`:"local" ResultSets, since in all other cases, such modifications would break the consistency of server and client row numbering needed for data paging, and also create some issues with automatic cache synchronization. See the "Modifying ResultSets" subtopic in the `ResultSet Overview` for the alternative approach of updating the `DataSource`.

      One known case where modification can be useful is when an array has been passed to `ListGrid.setData()` for a ListGrid with `ListGrid.filterLocalData`:true. If the data is filtered using the `filterEditor`, then a new local ResultSet will be created as `data` to reflect the filtering.

      Parameters:
        `modifiable` - New modifiable value. Default value is true
      Returns:
        `FilteredList` instance, for chaining setter calls
      See Also:
        `DataSource.addData(com.smartgwt.client.data.Record)`, `DataSource.removeData(com.smartgwt.client.data.Record)`, `DataSource.updateCaches(com.smartgwt.client.data.DSResponse)`

    - #### getModifiable

          public boolean getModifiable()

      When true, allows the ResultSet to be modified by list APIs `List.addAt()`, `List.set()`, and `List.removeAt()`. Only applies to `fetchMode`:"local" ResultSets, since in all other cases, such modifications would break the consistency of server and client row numbering needed for data paging, and also create some issues with automatic cache synchronization. See the "Modifying ResultSets" subtopic in the `ResultSet Overview` for the alternative approach of updating the `DataSource`.

      One known case where modification can be useful is when an array has been passed to `ListGrid.setData()` for a ListGrid with `ListGrid.filterLocalData`:true. If the data is filtered using the `filterEditor`, then a new local ResultSet will be created as `data` to reflect the filtering.

      Returns:
        Current modifiable value. Default value is true
      See Also:
        `DataSource.addData(com.smartgwt.client.data.Record)`, `DataSource.removeData(com.smartgwt.client.data.Record)`, `DataSource.updateCaches(com.smartgwt.client.data.DSResponse)`

    - #### invalidateCache

          public void invalidateCache()

      Invoking invalidateCache() will have no effect on a filteredList. To drop the allRows cache of data, consider passing an empty array to `setAllRows()`.
      Overrides:
        `invalidateCache` in class `ResultSet`