Skip to content

Commit

Permalink
Merge pull request #405 from sronveaux/attribute-table-unregister-events
Browse files Browse the repository at this point in the history
Unregister events properly inside AttributeTable component
  • Loading branch information
sronveaux authored Jun 20, 2024
2 parents 85e4364 + e7937c5 commit 3079b94
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit 3079b94

Please sign in to comment.