我知道我们可以使用没有单独列过滤器的独立过滤器( 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/