使用范围 n2-smart-table 过滤

Filter using range n2-smart-table

我正在使用 angular 2 组件 ng2-smart-table 并正在寻找一种按范围过滤记录的方法,例如,如果我有一个年龄列,我希望它被过滤为 ">90 或 <90" 而不是 "like '90'"。我环顾了各种论坛,但找不到这样的方法。

这就是我能够在单元格上应用自定义过滤器的方法,这样做会在用户尝试基于特定列进行过滤时调用此函数。

示例:

  columns: {    
    totalRows: {
    title: 'Total Rows',
    type: 'number',
    filterFunction(cell?: any, search?: string): boolean {          
      if (cell >= search || search === '') {
        return true;
      } else {
        return false;
      }          
    }
  }

这篇关于 ng2-smart-table 的文档也很有帮助:documentation