custom filter in mat-table

后端 未结 4 797
深忆病人
深忆病人 2020-11-29 01:54

I\'m using mat-table. It has a filter which works fine with doc example:

From https://material.angular.io/components/table/overview, the original code is:



        
4条回答
  •  迷失自我
    2020-11-29 02:51

    Be aware that all fields of the class displayed in table rows, are subject to filtering, even if you do not display that field as a column.

    export class City {
      id: number;//is not displayed in mat table
      code: string;
      name: string;
      country:Country;
    }
    

    Any filter for the dataSource of city table, also applies to id column, which generally we do not display to the end user.

    //this filter will also apply to id column
    this.cityDataSource.filter = filterValue;
    

提交回复
热议问题