Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying defintion expression directly instead of removing it #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/main/js/bundles/dn_querybuilder/QueryController.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ export default class QueryController {
fields[idProperty] = true;
}

const definitionExpression = toSQLWhere(complexQuery);
if (layer) {
// reset previously applied or initial definitionExpression to allow filtering the entire layer
if (layer._initialDefinitionExpression) {
layer.definitionExpression = layer._initialDefinitionExpression;
layer.definitionExpression = definitionExpression;
}
// save initial definitionExpression to enable reversion to initial state
if (layer._initialDefinitionExpression === undefined) {
Expand All @@ -96,9 +97,8 @@ export default class QueryController {

// filter mode
if (layer) {
this._setProcessing(tool, false, queryBuilderWidgetModel);
const definitionExpression = toSQLWhere(complexQuery);
layer.definitionExpression = definitionExpression;
this._setProcessing(tool, false, queryBuilderWidgetModel);
return;
} else {
// result-ui
Expand Down Expand Up @@ -132,6 +132,9 @@ export default class QueryController {
}
throw new Error("Could not process query result");
} else {
if(layer){
layer.definitionExpression = layer._initialDefinitionExpression;
}
this._logService.warn({
message: this.#i18n.errors.noResultsError
});
Expand Down
Loading