Skip to content

Commit 2514627

Browse files
committed
Improve table handling in QueryController and add required configuration for new handling
1 parent 13ebc5c commit 2514627

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/main/js/apps/sample/app.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
]
4949
},
5050
"bundles": {
51+
"result-api": {
52+
"Config": {
53+
"remove-empty-tables": false
54+
}
55+
},
5156
"dn_querybuilder": {
5257
"Config": {
5358
"closeOnQuery": true,

src/main/js/bundles/dn_querybuilder/QueryController.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { MemoryStore } from "./MemoryStore";
2121
import CachingStore from "./CachingStore";
2222
import { toSQLWhere } from "store-api/rest/ComplexQueryToSQL";
2323
import semver from "apprt/semver";
24+
import { table } from "console";
2425

2526
const DELAY = 500;
2627

@@ -192,8 +193,17 @@ export default class QueryController {
192193
this._setProcessing(tool, false, queryBuilderWidgetModel);
193194
}
194195
});
195-
const tableCollection = dataTableFactory.createDataTableCollection([dataTable]);
196-
const resultViewerServiceHandle = this._resultViewerService.open(tableCollection);
196+
let tableCollection = this._resultViewerService.currentDataTables;
197+
let resultViewerServiceHandle;
198+
if (tableCollection) {
199+
200+
tableCollection.add(dataTable);
201+
tableCollection.selectTables([dataTable.id]);
202+
tableCollection.clickTable(dataTable.id);
203+
} else {
204+
tableCollection = dataTableFactory.createDataTableCollection([dataTable]);
205+
resultViewerServiceHandle = this._resultViewerService.open(tableCollection);
206+
}
197207

198208
const that = this;
199209
this.#resultUiHandle = {
@@ -249,7 +259,7 @@ export default class QueryController {
249259
layerId: store.layerId
250260
});
251261
}
252-
if(useIn?.includes("selection")) {
262+
if (useIn?.includes("selection")) {
253263
tempStore?.load();
254264
}
255265
const filter = new Filter(tempStore, complexQuery);

0 commit comments

Comments
 (0)