mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
improved multi column filter #855
Some checks are pending
Run tests / test-runner (push) Waiting to run
Some checks are pending
Run tests / test-runner (push) Waiting to run
This commit is contained in:
parent
e5fb3414fe
commit
315c0670d0
@ -214,14 +214,14 @@ export abstract class GridDisplay {
|
||||
}
|
||||
|
||||
if (this.baseTableOrView && this.config.multiColumnFilter) {
|
||||
try {
|
||||
const condition = parseFilter(this.config.multiColumnFilter, 'string');
|
||||
if (condition) {
|
||||
const orCondition: CompoudCondition = {
|
||||
conditionType: 'or',
|
||||
conditions: [],
|
||||
};
|
||||
for (const column of this.baseTableOrView.columns) {
|
||||
const orCondition: CompoudCondition = {
|
||||
conditionType: 'or',
|
||||
conditions: [],
|
||||
};
|
||||
for (const column of this.baseTableOrView.columns) {
|
||||
try {
|
||||
const condition = parseFilter(this.config.multiColumnFilter, getFilterType(column.dataType));
|
||||
if (condition) {
|
||||
orCondition.conditions.push(
|
||||
_.cloneDeepWith(condition, (expr: Expression) => {
|
||||
if (expr.exprType == 'placeholder') {
|
||||
@ -230,12 +230,13 @@ export abstract class GridDisplay {
|
||||
})
|
||||
);
|
||||
}
|
||||
if (orCondition.conditions.length > 0) {
|
||||
conditions.push(orCondition);
|
||||
}
|
||||
} catch (err) {
|
||||
// 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 => ({
|
||||
...cfg,
|
||||
filters: {},
|
||||
multiColumnFilter: null,
|
||||
}));
|
||||
this.reload();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user