setFilter( columnIndex, expression )



This method filters grid data by applying a filter expression to a specific column. The expression is not case sensitive. The filtered text may be highlighted. The highlighting can be cleared using the clearHighlighting() method on the grid.

Parameters:

  • columnIndex - index to identify the column, where 0 is the first column, 1 is the second column, etc. For client-side filtering, a special value of "*all" can be specified, which triggers a filter on all columns.

  • expression - expression to filter grid data, with the following syntax:

    • xyz - searches for all data containing 'xyz'

    • between aaa and zzz - searches for alphanumeric values between 'aaa' and 'zzz'

    • between 10 and 20 - searches for numeric values between 10 and 20 

    • starts with xyz - searches for all data that starts with 'xyz'

    • values A, B, C, etc. - searches for a list of values (exact matches)

    • =xyz - searches for data equal exactly to 'xyz'

    • >123 - greater than search

    • >=123 - greater or equal to search

    • <123 - less than search

    • <=123 - less than or equal to search

    • !=xyz - searches for alphanumeric values that do not contain 'xyz'

    • !=123 - searches for numeric values that are not equal to 123

*Column 0 refers to the first column as established during design-time (in Visual Designer). If movable columns is true, then the user could change the column order. removeColumn(0) removes what was originally the first column, even if the user has moved that column.

The expressions above may also be typed into the grid's filter input box to filter for an expression.

Example:

getObj("Grid1").grid.setFilter(0, "xyz");



Filtering is available for handler-populated (load-all) grids starting with Profound UI Version 5, Fix Pack 1.1 and later. Database-Driven and Custom SQL grids support filtering as of Profound UI Version 5, Fix Pack 6.0 and later. Data URL grids support Filtering as of Profound UI Version 5, Fix Pack 6.1 and later.

For handler-populated page-at-a-time grids, filter input is passed directly to the server-side program, so expressions must be handled by the server-side program. See Filter Response.

If a column uses an SQL expression, such as concatenate, it must be aliased or the filter feature will not work with it. The alias name may be any valid alias; for example, COL5.

See the section, Filtering and Sorting Limitations with Custom SQL, in the page Database-driven Grids for more information about filtering Custom SQL grids.