in sample/frontend/agr-lib/src/lib/grid/agr-engine.ts [475:521]
filter() {
this.rows = [...this.rowsCache];
this.rows = this.rows.filter((row) => {
let logicResult = true;
let wasReInit = false;
row.filteredChildren = [];
for (const columnDef of this.filterColumnsData.values()) {
if (Array.isArray(columnDef)) {
let groupLogicResult = false;
if (!wasReInit) {
logicResult = true;
wasReInit = true;
}
for (const childColumnDef of columnDef) {
groupLogicResult ||= (this.filterByColumn(childColumnDef, row) ||
this.filterChild((row as any).children, childColumnDef) ||
this.filterParent(row, childColumnDef));
}
logicResult &&= groupLogicResult;
} else {
// Re-init value of logicResult depends on logic condition from first filter: OR or AND
if (!wasReInit) {
wasReInit = true;
logicResult = columnDef.filter.condition !== 'OR';
}
switch (columnDef.filter.condition) {
case 'OR':
logicResult ||= (this.filterByColumn(columnDef, row) ||
this.filterChild((row as any).children, columnDef) ||
this.filterParent(row, columnDef));
break;
default:
logicResult &&= (this.filterByColumn(columnDef, row) ||
this.filterChild((row as any).children, columnDef) ||
this.filterParent(row, columnDef));
}
}
}
if (logicResult && !this.isCollapsedParent(row)) {
row.addToFilteredChildren();
return true;
}
return false;
});
this.sort();
this.recalculateSelected();
}