angular - 是否可以将独立过滤器与柱过滤器一起使用?

标签 angular ng2-smart-table

我知道我们可以使用没有单独列过滤器的独立过滤器( https://akveo.github.io/ng2-smart-table/#/examples/using-filters ),但是是否可以同时使用两者?

我尝试实现它但无法实现。请参阅https://stackblitz.com/edit/angular-2cwakj?file=src%2Fapp%2Ffilter-poc%2Ffilter-poc.component.ts

最佳答案

使用以下函数更改您的 onSearch 函数。

  onSearch(query: string = '') {
   this.source = new LocalDataSource(this.data.filter((obj)=>{
   if(obj.id.toString().indexOf(query)>-1 || obj.name.indexOf(query)>-1 || 
    obj.username.indexOf(query)>-1 ||obj.email.indexOf(query)>-1 ) return true;
   else false;
  }))
 }

关于angular - 是否可以将独立过滤器与柱过滤器一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60256682/

相关文章:

angular6 - ./node_modules/ng2-completer/esm5/ng2-completer.js 模块未找到 : Error

特定条件下小数的 Angular 输入验证

authentication - ASP.NET Core Web API + Angular 2 授权和认证

angularjs - 每当添加新行时,如何在 ng2-smart-table 中使用 post 方法?

node.js - Angular 6 - 删除node_module包并将其用于本地项目更改

angular - 如何删除 ng2-smart-table 中的一行

c# - SignalR 在 Hub 或 Controller 中实现 CRUD 方法

angular - 如何使用 Angular 4 动画经历多个状态?

Angular 4 FilterBy 管道

json - Table Angular 2 (ng2-smart-table) - 从 JSON 获取所有数据(对于 json 的每个级别)