improved multi column filter #855

This commit is contained in:
Jan Prochazka
2024-07-24 13:52:34 +02:00
parent e5fb3414fe
commit 315c0670d0

View File

@@ -214,14 +214,14 @@ export abstract class GridDisplay {
} }
if (this.baseTableOrView && this.config.multiColumnFilter) { if (this.baseTableOrView && this.config.multiColumnFilter) {
try { const orCondition: CompoudCondition = {
const condition = parseFilter(this.config.multiColumnFilter, 'string'); conditionType: 'or',
if (condition) { conditions: [],
const orCondition: CompoudCondition = { };
conditionType: 'or', for (const column of this.baseTableOrView.columns) {
conditions: [], try {
}; const condition = parseFilter(this.config.multiColumnFilter, getFilterType(column.dataType));
for (const column of this.baseTableOrView.columns) { if (condition) {
orCondition.conditions.push( orCondition.conditions.push(
_.cloneDeepWith(condition, (expr: Expression) => { _.cloneDeepWith(condition, (expr: Expression) => {
if (expr.exprType == 'placeholder') { if (expr.exprType == 'placeholder') {
@@ -230,12 +230,13 @@ export abstract class GridDisplay {
}) })
); );
} }
if (orCondition.conditions.length > 0) { } catch (err) {
conditions.push(orCondition); // skip for this column
} continue;
} }
} catch (err) { }
console.warn(err.message); if (orCondition.conditions.length > 0) {
conditions.push(orCondition);
} }
} }
@@ -482,6 +483,7 @@ export abstract class GridDisplay {
this.setConfig(cfg => ({ this.setConfig(cfg => ({
...cfg, ...cfg,
filters: {}, filters: {},
multiColumnFilter: null,
})); }));
this.reload(); this.reload();
} }