Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase realtime database Mat表格按列筛选Firebase中的数据_Firebase Realtime Database_Filter_Angular Material_Mat Table - Fatal编程技术网

Firebase realtime database Mat表格按列筛选Firebase中的数据

Firebase realtime database Mat表格按列筛选Firebase中的数据,firebase-realtime-database,filter,angular-material,mat-table,Firebase Realtime Database,Filter,Angular Material,Mat Table,我使用角度6,火基和材料角度。我可以将数据加载到表中,对它们进行排序,使用分页器,并对它们进行全局筛选 我现在想修改我的过滤器,使其只在“名称”列上进行过滤,并在“公共”列上有第二个要过滤的过滤器字段 你能帮助我采取什么策略吗 @Component({ selector: 'app-table', templateUrl: './table.component.html', styleUrls: ['./table.component.scss'] }) export class TableC

我使用角度6,火基和材料角度。我可以将数据加载到表中,对它们进行排序,使用分页器,并对它们进行全局筛选

我现在想修改我的过滤器,使其只在“名称”列上进行过滤,并在“公共”列上有第二个要过滤的过滤器字段

你能帮助我采取什么策略吗

@Component({
selector: 'app-table',
templateUrl: './table.component.html',
styleUrls: ['./table.component.scss']
})

export class TableComponent implements OnInit {

showSpinner = true;

Data = {nom: '',finessgeo:'', cat1: '', commune: '',CP: '',departement:'',tel: ''}

displayedColumns = ['nom', 'finessgeo', 'cat1', 'commune', 'CP',    'departement',  'tel'];
dataSource = new MatTableDataSource();

applyFilter(filterValue: string) {
filterValue = filterValue.trim(); 
filterValue = filterValue.toLowerCase(); 
this.dataSource.filter = filterValue;
}

@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;

ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}

constructor(public authService: AuthService,private geoService: GeoService, private router: Router,private database: AngularFireDatabase) { }


onNewGeo() {
this.router.navigate(['']);
}

onSignOut() { this.authService.signOutUser(); }

ngOnInit() { return this.geoService.getGeos().subscribe(res =>{this.dataSource.data = res;this.showSpinner = false;});  }}


export class DataDataSource extends DataSource<any> {

constructor(private geoService: GeoService) { super() }

connect() {return this.geoService.getGeos();}
disconnect() {}
}
@组件({
选择器:“应用程序表”,
templateUrl:'./table.component.html',
样式URL:['./table.component.scss']
})
导出类TableComponent实现OnInit{
showSpinner=true;
数据={nom:'',finessgeo:'',cat1:'',通讯:'',CP:'',部门:'',电话:'}
displayedColumns=['nom'、'finessgeo'、'cat1'、'commune'、'CP'、'Department'、'tel'];
dataSource=新MatTableDataSource();
applyFilter(filterValue:string){
filterValue=filterValue.trim();
filterValue=filterValue.toLowerCase();
this.dataSource.filter=filterValue;
}
@ViewChild(MatPaginator)分页器:MatPaginator;
@ViewChild(MatSort)排序:MatSort;
ngAfterViewInit(){
this.dataSource.paginator=this.paginator;
this.dataSource.sort=this.sort;
}
构造函数(公共authService:authService,私有geoService:geoService,私有路由器:路由器,私有数据库:AngularFireDatabase){}
onNewGeo(){
这个.router.navigate(['']);
}
onSignOut(){this.authService.signOutUser();}
ngOnInit(){返回this.geoService.getGeos().subscribe(res=>{this.dataSource.data=res;this.showSpinner=false;});}
导出类DataDataSource扩展了DataSource{
构造函数(专用geoService:geoService){super()}
connect(){返回this.geoService.getGeos();}
断开连接(){}
}
尝试以下代码:

ngOnInit() {
    this.dataSource.filterPredicate = function(data, filter: string): boolean {
      return data.name.toLowerCase().includes(filter) || data.nom.toString() === filter;
    };
  }