Version 1
Version 1

Filtering

DataViewsJS allows you to write a string expression and use it in a filtering condition. You can implement simple as well as complex filtering expressions in code using dataview.data.filter('FILTER EXPRESSION') syntax.

Use the following steps to implement filtering in DataViewsJS.

Sample Code

These steps assume that you have already initialized the grid and defined the columns. See Creating a Basic Grid and Defining Columns for additional information.

Example 1
This example code uses a simple expression for filtering.

dataview.data.filter('[quantity]>=5');

Example 2
This example code uses a complex expression for filtering to show records for United States with New York as the state and quantity greater than 5.

dataview.data.filter('[Country]="United States" && [State]="NY" && [quantity] > 5');

See also