ng-material-extensions icon indicating copy to clipboard operation
ng-material-extensions copied to clipboard

how to filter with multiple values for single column?

Open Lakshman691 opened this issue 3 years ago • 1 comments

how to filter with multiple values for the single column? Is it possible? does this functionality already exist?.

My Scenario:

I want to use a mat multi-select for a grid column filter, I want to be able to select multiple values and filter the grid based on the selection. currently, when I'm trying to do that it's not returning any data.

can you help me..?

Lakshman691 avatar Jun 24 '21 12:06 Lakshman691

This case is not out-of-the-box covered because the filter entity is supposed to map the entities listed in the table. However you can achieve what you want with a custom property filtering like below.

**HTML**
<mat-table matTableFilter [exampleEntity]="filterEntity" [propertyOptions]="propertyOptions"
[filterType]="filterType" [dataSource]="dataSource" class="mat-elevation-z8">

**TS**
this.propertyOptions = {yourProperty: (item: string) => { // Custom filtering for yourProperty
   return this.yourArrayOfSelections.includes(item);
 }};

HalitTalha avatar Jun 26 '21 08:06 HalitTalha