mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 10:16:03 +00:00
improved multi column filter #855
This commit is contained in:
@@ -214,14 +214,14 @@ export abstract class GridDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.baseTableOrView && this.config.multiColumnFilter) {
|
if (this.baseTableOrView && this.config.multiColumnFilter) {
|
||||||
try {
|
|
||||||
const condition = parseFilter(this.config.multiColumnFilter, 'string');
|
|
||||||
if (condition) {
|
|
||||||
const orCondition: CompoudCondition = {
|
const orCondition: CompoudCondition = {
|
||||||
conditionType: 'or',
|
conditionType: 'or',
|
||||||
conditions: [],
|
conditions: [],
|
||||||
};
|
};
|
||||||
for (const column of this.baseTableOrView.columns) {
|
for (const column of this.baseTableOrView.columns) {
|
||||||
|
try {
|
||||||
|
const condition = parseFilter(this.config.multiColumnFilter, getFilterType(column.dataType));
|
||||||
|
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,14 +230,15 @@ export abstract class GridDisplay {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// skip for this column
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (orCondition.conditions.length > 0) {
|
if (orCondition.conditions.length > 0) {
|
||||||
conditions.push(orCondition);
|
conditions.push(orCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.warn(err.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conditions.length > 0) {
|
if (conditions.length > 0) {
|
||||||
select.where = {
|
select.where = {
|
||||||
@@ -482,6 +483,7 @@ export abstract class GridDisplay {
|
|||||||
this.setConfig(cfg => ({
|
this.setConfig(cfg => ({
|
||||||
...cfg,
|
...cfg,
|
||||||
filters: {},
|
filters: {},
|
||||||
|
multiColumnFilter: null,
|
||||||
}));
|
}));
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user