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

Unregister events properly inside AttributeTable component #405

Merged
Merged
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
17 changes: 17 additions & 0 deletions src/components/attributeTable/AttributeTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export default {
// unregister event after table is closed
this.layer.getSource().un('change', this.prepareTableDataAndColumns);
}

if (this.syncTableMapSelection) {
this.deactivateSelectRowOnMapClick();
}
},
watch: {
layerId () {
Expand Down Expand Up @@ -172,6 +176,14 @@ export default {
});
},

/**
* Deactivate behaviour that a selected feature on the
* map will be selected in the AttributeTable as well.
*/
deactivateSelectRowOnMapClick () {
WguEventBus.$off('map-selectionchange');
},

/**
* Highlight row matching the feature ID
* and set correct page of the table.
Expand Down Expand Up @@ -247,6 +259,11 @@ export default {
return;
}

// unregister change event on previous layer source if any
if (this.layer) {
this.layer.getSource().un('change', this.prepareTableDataAndColumns);
}

// reset table properties
this.records = [];
this.features = [];
Expand Down
Loading