[]
The wijmo.grid.filter module provides a FlexGridFilter class that adds an Excel-style filtering UI to each column. The FlexGridFilter provides two types of filter: by value and by condition.
The value filter editor contains a list of unique values for the user to choose from. If the grid contains a lot of data, this list of unique values may take a while to generate. Furthermore, if the list contains too many values, it is not very useful (a condition filter may be more appropriate in these cases)
This sample shows how you can optimize the value filters in three ways:
import * as wjGrid from '@mescius/wijmo.grid';
import * as wjGridFilter from '@mescius/wijmo.grid.filter';
function init() {
// FlexGridFilter client-side filtering
var theGrid = new wjGrid.FlexGrid('#theGrid', {
itemsSource: data
});
var filter = new wjGridFilter.FlexGridFilter(theGrid);
// ratings are values from 0 to 5
var filterRating = filter.getColumnFilter('rating');
filterRating.valueFilter.uniqueValues = [0, 1, 2, 3, 4, 5];
// limit number of values shown in sales filter
var filterSales = filter.getColumnFilter('sales');
filterSales.valueFilter.maxValues = 20;
// filter expenses only by condition
var filterExpenses = filter.getColumnFilter('expenses');
filterExpenses.filterType = wjGridFilter.FilterType.Condition;
}