dojox/grid/enhanced/plugins/Filter (version 1.10)

dojox/grid/enhanced/_Plugin

Summary

Provide filter functionality for grid.

Acceptable plugin parameters:

  1. itemsName: string: the name shown on the filter bar.
  2. statusTipTimeout: number: when does the status tip show.
  3. ruleCount: number: default to 3, should not change to more. The Claro theme limits it.
  4. disabledConditions: object: If you don't need all of the conditions provided for a data type, you can explicitly declare them here: e.g.: disabledConditions: {string: ["contains", "is"], number: ["equalto"], ...}
  5. isServerSide: boolean: Whether to use server side filtering. Default to false.
  6. isStateful: boolean: If isServerSide is true, set the server side filter to be stateful or not. default to false.
  7. url: string: If using stateful, this is the url to send commands. default to store.url.
  8. ruleCountToConfirmClearFilter: Integer | null |Infinity: If the filter rule count is larger than or equal to this value, then a confirm dialog will show when clearing filter. If set to less than 1 or null, then always show the confirm dialog. If set to Infinity, then never show the confirm dialog. Default value is 2.

Acceptable cell parameters defined in layout:

  1. filterable: boolean: The column is not filterable only when this is set to false explicitly.
  2. datatype: string: The data type of this column. Can be "string", "number", "date", "time", "boolean". Default to "string".
  3. autoComplete: boolean: If need auto-complete in the ComboBox for String type, set this to true.
  4. dataTypeArgs: object: Some arguments helping convert store data to something the filter UI understands. Different data type arguments can be provided to different data types. For date/time, this is a dojo.date.locale.__FormatOptions, so the DataTimeBox can understand the store data. For boolean, this object contains:

    • trueLabel: string: A label to display in the filter definition dialog for true value. Default to "True".
    • falseLabel: string: A label to display in the filter definition dialog for false value. Default to "False".
  5. disabledConditions: object: If you don't need all of the conditions provided by the filter UI on this column, you can explicitly say it out here. e.g.: disabledConditions: ["contains", "is"] This will disable the "contains" condition for this column, if this column is of string type. For full set of conditions, please refer to dojox.grid.enhanced.plugins.filter.FilterDefDialog._setupData.

Usage

var foo = new Filter(grid,args);
dojox/grid/enhanced/plugins/Filter
Parameter Type Description
grid undefined
args undefined

Examples

Example 1

<div dojoType="dojox.grid.EnhancedGrid" plugins="{GridFilter: true}" ...></div>
or provide some parameters:
<div dojoType="dojox.grid.EnhancedGrid" plugins="{GridFilter: {itemsName: 'songs'}}" ...></div>
Customize columns for filter:
var layout = [
    ...
    //define a column to be un-filterable in layout/structure
    {field: "Genre", filterable: false, ...}
    //define a column of type string and supports autoComplete when you type in filter conditions.
    {field: "Writer", datatype: "string", autoCommplete: true, ...}
    //define a column of type date and the data in store has format: "yyyy/M/d"
    {field: "Publish Date", datatype: "date", dataTypeArgs: {datePattern: "yyyy/M/d"}, ...}
    //disable some conditions for a column
    {field: "Track", disabledConditions: ["equalto","notequalto"], ...}
    ...
];

Property Summary

  • _connectsList of all connections.
  • _subscribesList of all subscribes.
  • gridGrid that the plugin belongs to
  • nameplugin name
  • optionPlugin properties - leveraged with default and user specified properties. e.g. for dnd plugin, it may look like {&quot;class&quot;: dojox.grid.enhanced.plugins.DnD, &quot;dependency&quot;: [&quot;nestedSorting&quot;], ...}
  • privatesPrivate properties/methods shouldn&#39;t be mixin-ed anytime.

Method Summary

  • _clientFilterGetter(datarow,cell,rowIndex) Define the grid-specific way to get data from a row.
  • _wrapStore()
  • connect(obj,event,method) Connects specified obj/event to specified method of this object.
  • destroy()
  • disconnect(handle) Disconnects handle and removes it from connection list.
  • init()
  • subscribe(topic,method) Subscribes to the specified topic and calls the specified method of this object.
  • unsubscribe(handle) Un-subscribes handle and removes it from subscriptions list.

Event Summary

Properties

_connects

List of all connections.

_subscribes

List of all subscribes.

grid

Grid that the plugin belongs to

name

plugin name

option

Plugin properties - leveraged with default and user specified properties. e.g. for dnd plugin, it may look like {"class": dojox.grid.enhanced.plugins.DnD, "dependency": ["nestedSorting"], ...}

privates

Private properties/methods shouldn't be mixin-ed anytime.

Methods

_clientFilterGetter(datarow,cell,rowIndex)

Define the grid-specific way to get data from a row. Argument "cell" is provided by FilterDefDialog when defining filter expressions. Argument "rowIndex" is provided by FilterLayer when checking a row. FilterLayer also provides a forth argument: "store", which is grid.store, but we don't need it here.

Parameter Type Description
datarow data item
cell cell
rowIndex int
Returns:undefined
_wrapStore()
connect(obj,event,method)

Connects specified obj/event to specified method of this object.

Parameter Type Description
obj undefined
event undefined
method undefined
Returns:undefined

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when foo.bar() is called, call the listener in the scope of plugin
plugin.connect(foo, "bar", function(){
    console.debug(this.xxx());//"this" - plugin scope
});
destroy()
disconnect(handle)

Disconnects handle and removes it from connection list.

Parameter Type Description
handle undefined
init()
subscribe(topic,method)

Subscribes to the specified topic and calls the specified method of this object.

Parameter Type Description
topic undefined
method undefined
Returns:undefined

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
unsubscribe(handle)

Un-subscribes handle and removes it from subscriptions list.

Parameter Type Description
handle undefined

Events

onPostInit()

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
onPreInit()

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
onSetStore(store)
Parameter Type Description
store undefined

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
onStartUp()

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
Error in the documentation? Can’t find what you are looking for? Let us know!