Filtering

Enable Filtering

To do column filterable, it needs to set in column property filter.
To show filter field in column header, needs to set filter.header: true


new FancyGrid({
  ...
  columns: [{
    index: 'company',
    title: 'Company',
    locked: true,
    filter: {
      header: true,
      emptyText: 'Search'
    }
  ...

Enable Search Filtering

Search is sub feature of filtering.
To enable it, it requires to define in tbar search field.


new FancyGrid({
  ...
  tbar: [{
    type: 'search',
    width: 350,
    emptyText: 'Search',
    paramsMenu: true,
    paramsText: 'Parameters'
  }],
  ...

Filter operators

There are several operator that possible to use in filter field.
They are: <,>,<=,>=,=,!=

Server filtering

Enable server filtering is the same, but also needs to set in data remoteFilter: true and there are params that are sent in request.

Example of server filtering


new FancyGrid({
	...
  data: {
    remoteSort: true,
    remoteFilter: true,
    proxy: {
      url: '/ajax/filter.php'
    }
  },
  ...

Filter param is array. Each item contains 3 property, they are:

operator

Filter operator.

value

Filter value.

property

Data index by which needs to filter.

Example of filter request params


filter: [{
  operator: 'lt',
  value: 30,
  property: 'age'
},{
  operator: 'like',
  value: 'Adobe',
  property: 'company'
}]

Operators can not be sent on server as <, >, = and others.
That is why there are alternative names for them.