Implementing NGX Datatable filtering on all columns

后端 未结 8 753
不知归路
不知归路 2021-02-06 04:21

I\'ve been trying to get this working with no luck. I\'ve been referencing these resources for help: http://swimlane.github.io/ngx-datatable/#filter
https://github.com/swiml

8条回答
  •  梦毁少年i
    2021-02-06 04:43

    You might be helped

     
          
          
    
    
    
    
    updateFilter(event) {
        const val = event.target.value.toLowerCase();
    
        // filter our data
        const temp = this.temp.filter(function(d) {
          return d.name.toLowerCase().indexOf(val) !== -1 ||
            d.address.toLowerCase().indexOf(val) !== -1 ||
            d.gender.toLowerCase().indexOf(val) !== -1 || !val;
        });
    
        // update the rows
        this.rows = temp;
        // Whenever the filter changes, always go back to the first page
        this.table.offset = 0;
      }
    

    https://github.com/swimlane/ngx-datatable/blob/master/src/app/basic/dark-theme.component.ts

提交回复
热议问题