Docs
API
  • addFilter(dataIndex: String, value: Mixed)

    Adds filter by index with value.

    To use this method it requires to set property filter: true

    Example

    
    var grid = new FancyGrid({
      ...
      filter: true,
      ...
    });
    
    grid.addFilter('name', 'Nick');
    

    addFilter(dataIndex: String, value: Mixed, sign: String)

    Adds filter by index with value and sign.

    List of signs available in section Filtering

    To use this method it requires to set property filter: true

    Example

    
    var grid = new FancyGrid({
      ...
      filter: true,
      ...
    });
    
    grid.addFilter('age', 30, '<');
    

    Example: Several params

    
    var grid = new FancyGrid({
      ...,
      filter: true,
      ...
    });
    
    grid.addFilter('name', ['Nick', 'Peter'], '=');
    

    Example: filtering date column

    
    var grid = new FancyGrid({
      ...,
      filter: true,
      ...
    });
    //Find items with dates less than 1-st January of 1977
    grid.addFilter('birthday', new Date(1977, 0, 1), '<');
    

    Example: filtering date column with string value.

    In FancyGrid there is help function to parse string value to date.
    It is Fancy.Date.parse('1977.07.21', 'Y.m.d');

    
    var grid = new FancyGrid({
      ...,
      filter: true,
      ...
    });
    
    //Find items with dates more than 21-st July of 1977
    grid.addFilter('birthday', Fancy.Date.parse('1977.07.21', 'Y.m.d'), '>');
    

    Example: custom filtering over handler

    
    grid.addFilter('name', function(value, item){
      switch(value){
        case 'Nick':
        case 'Ivan':
        case 'Lorenzo':
          switch(item.get('position')){
            case 'CEO':
            case 'Manager':
              return true;
          }
    	  break;
      }
    
      return false;
    });
    

    Example: Multi filtering at a time

    
    var grid = new FancyGrid({
      ...
      filter: true,
      ...
    });
    
    ...
    grid.waitingForFilters = true;
    grid.addFilter('name', 'Nick');
    grid.addFilter('surname', 'Thomson');
    grid.updateFilters();// It will update grid and set waitingForFilters to false. 
    

    See also

    Method clearFilter
    Method find
    Method findItem
    Method getDataFiltered
    Method search
    Method updateFilters

    Doc link Filtering