dojox/grid/enhanced/plugins/filter/FilterLayer.ClientSideFilterLayer (version 1.10)

Summary

Add a client side filter layer on top of the data store, so any filter expression can be applied to the store.

Usage

var foo = new FilterLayer.ClientSideFilterLayer(args);
dojox/grid/enhanced/plugins/filter/FilterLayer
Parameter Type Description
args undefined

Property Summary

Method Summary

  • _addCachedItems(items,filterStartIdx) Add data items to the cache.
  • _applyFilter(datarow,rowIndex) Apply the filter to a row of data
  • _completeQuery(userRequest) Logically, the user's query is completed here, i.e., all the filtered results are ready. (or their index mappings are ready)
  • _defaultGetter(datarow,colName,rowIndex,store)
  • _doFilter(items,startIdx,userRequest) Use the filter expression to filter items.
  • _fetch(userRequest,filterRequest) Implement _StoreLayer._fetch
  • _hasReachedStoreEnd() Check whether all the items in the original store have been fetched.
  • _unwrap(nextLayer) Do the actual unwrapping to the store.
  • _wrap(store,funcName,layerFuncName,nextLayer) Do the actual wrapping (or 'hacking' if you like) to the store.
  • enabled(toEnable) The get/set function of the enabled status of this layer
  • fetchAllOnFirstFilter(toFetchAll) The get/set function for fetchAll.
  • filterDef(filter) See _FilterLayerMixin.filterDef
  • initialize(store)
  • invalidate() Clear all the status information of this layer
  • name() Get the name of this store layer.
  • originFetch()
  • setGetter(getter) Set the user defined way to retrieve data from store.
  • uninitialize(store)

Event Summary

Properties

__enabled

To control whether this layer is valid.

_filter

The filter definition

_getter

A user defined way to get data from store

_indexMap

A map from the row index of this._items to the row index of the original store.

_items

Cached items (may contain holes)

_nextUnfetchedIdx

The index of the next item in the store that is never fetched.

_originFetch

The original fetch function of the store.

_result

Current fetch result

_resultStartIdx

The index in cache of the first result item

_store

The wrapped store.

_storeSize

The actual size of the original store

layerFuncName

Methods

_addCachedItems(items,filterStartIdx)

Add data items to the cache. The insert point is at filterStartIdx

Parameter Type Description
items Array

Data items to add.

filterStartIdx Integer

The start point to insert in the cache.

Returns:undefined
_applyFilter(datarow,rowIndex)

Apply the filter to a row of data

Parameter Type Description
datarow data item
rowIndex Integer
Returns:any | boolean

whether this row survived the filter.

_completeQuery(userRequest)

Logically, the user's query is completed here, i.e., all the filtered results are ready. (or their index mappings are ready)

Parameter Type Description
userRequest request object
_defaultGetter(datarow,colName,rowIndex,store)
Parameter Type Description
datarow undefined
colName undefined
rowIndex undefined
store undefined
Returns:undefined
_doFilter(items,startIdx,userRequest)

Use the filter expression to filter items. Survived items are stored in this._items. The given items start from "startIdx" in the original store.

Parameter Type Description
items Array
startIdx Integer
userRequest object
_fetch(userRequest,filterRequest)

Implement _StoreLayer._fetch

Parameter Type Description
userRequest undefined
filterRequest dojo/data/api/Request

The actual request used in store.fetch. This function is called recursively to fill the result store items until the user specified item count is reached. Only in recursive calls, this parameter is valid.

Returns:undefined
_hasReachedStoreEnd()

Check whether all the items in the original store have been fetched.

Returns:boolean
_unwrap(nextLayer)

Do the actual unwrapping to the store.

Parameter Type Description
nextLayer undefined
_wrap(store,funcName,layerFuncName,nextLayer)

Do the actual wrapping (or 'hacking' if you like) to the store.

Parameter Type Description
store undefined

The store to be unwrapped.

funcName undefined
layerFuncName undefined
nextLayer undefined
enabled(toEnable)

The get/set function of the enabled status of this layer

Parameter Type Description
toEnable Boolean
Optional

If given, is a setter, otherwise, it's getter.

Returns:boolean
fetchAllOnFirstFilter(toFetchAll)

The get/set function for fetchAll.

Parameter Type Description
toFetchAll boolean
Optional

If provided, it's a set function, otherwise it's a get function.

Returns:any | boolean

Whether fetch all on first filter if this is a getter

filterDef(filter)

See _FilterLayerMixin.filterDef

Parameter Type Description
filter (_ConditionExpr | null)
Optional
Returns:(_ConditionExpr|null)
initialize(store)
Parameter Type Description
store undefined
invalidate()

Clear all the status information of this layer

name()

Get the name of this store layer. The default name retrieved from class name, which should have a pattern of "{name}Layer". If this pattern does not exist, the whole class name will be this layer's name. It's better to override this method if your class name is too complicated.

Returns:any | undefined

The name of this layer.

originFetch()
Returns:undefined
setGetter(getter)

Set the user defined way to retrieve data from store.

Parameter Type Description
getter function
uninitialize(store)
Parameter Type Description
store undefined

Events

_onFetchBegin(size,req)

This function is used to replace the user's onFetchBegin in store.fetch

Parameter Type Description
size Integer
req request object
onFilterDefined(filter)
Parameter Type Description
filter undefined
onFiltered(filteredSize,totalSize)

Called when store data is filtered. This event is before onComplete, after onBegin.

Parameter Type Description
filteredSize Integer

The number of remaining fetched items after filtering.

totalSize Integer

The number of original fetched items.

onRowMappingChange(mapping)
Parameter Type Description
mapping undefined
Error in the documentation? Can’t find what you are looking for? Let us know!