Reputation: 2470
ag-grid only promotes the use of filtering columns based on AND
,and they allow you to doAND/OR
within a single column itself, but so far I have not been able to find the ability to do a filter using OR
across multiple columns.
For instance, if I wanted a filter group for (Status1 = 5
OR Status1 = 6
) OR (Age > 30
).
The first group would currently work, Status1 equals 5 or 6, but doing an OR for age is the question, how could this be accomplished? If it's even possible at all without a ton of additional custom configuration?
Documentation: https://www.ag-grid.com/javascript-grid-filtering/
Example of the filtering: https://www.ag-grid.com/example.php#/filtering/1
Upvotes: 5
Views: 1159
Reputation: 1029
Assuming you are using custom filters you can do the following. I am using another column 'Active' as an example.
doesFilterPass(params: IDoesFilterPassParams): boolean {
const passesHere ... your filter logic
// Get the other filter.
const activeFilterPasses = this.api.getFilterInstance('Active').doesFilterPass(params);
return passesHere && activeFilterPasses; // Here it does AND filter between two columns.
}
Upvotes: 1