【问题标题】:Tabulator - Is there a way to prevent header filtering and only apply header filters programmatically?制表器 - 有没有办法防止标题过滤并仅以编程方式应用标题过滤器?
【发布时间】:2022-01-07 16:17:41
【问题描述】:

我有一个包含 15 列的表,其中包含使用 ajaxFiltering 的 headerFilters。

我希望能够将我的所有过滤条件输入到标题过滤器中,然后按一个按钮一次应用所有过滤器。我曾尝试使用headerFilterLiveFilter:false,但这只会在输入该 headerFilter 时停止实时过滤。一旦我点击另一个 headerFilter,它就会应用上一个过滤器,我必须等待输入下一个条件。

非常感谢我在文档中遗漏的任何内容或任何解决方法。

【问题讨论】:

    标签: javascript jquery tabulator


    【解决方案1】:

    申请customHeaderFilter。然后在你的函数中你可以决定做什么。

    【讨论】:

      【解决方案2】:

      如果您想应用用户无法更改的过滤器,那么您不应该使用标题过滤器,您应该使用标准过滤器,这些可以通过调用 setFilter 函数来添加。

      table.setFilter("name", "!=", "Steve");
      

      这个函数也可以一次接受多个过滤器,作为一个数组:

      table.setFilter([
          {field:"age", type:">", value:52}, //filter by age greater than 52
          {field:"height", type:"<", value:142}, //and by height less than 142
          {field:"name", type:"in", value:["steve", "bob", "jim"]}, //name must be steve, bob or jim
      ]);
      
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-03-19
        • 1970-01-01
        • 1970-01-01
        • 2023-03-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多