From ebcac70341942ee066c04b034a86837e754a5121 Mon Sep 17 00:00:00 2001 From: Erki Aas Date: Wed, 9 Nov 2022 11:28:08 +0200 Subject: [PATCH] Main grid: fix row referencing, do not add duplicate rows --- src/components/Grid/Main/config.js | 1 - src/components/LogViewer.vue | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Grid/Main/config.js b/src/components/Grid/Main/config.js index d099268..9f2101e 100644 --- a/src/components/Grid/Main/config.js +++ b/src/components/Grid/Main/config.js @@ -1,7 +1,6 @@ import ComboboxFilter from "../../Filter/ComboboxFilter"; const config = { - getRowId: params => params.data._id, defaultColDef: { width: 120, initialPinned: true, diff --git a/src/components/LogViewer.vue b/src/components/LogViewer.vue index 2281d21..7876aa1 100644 --- a/src/components/LogViewer.vue +++ b/src/components/LogViewer.vue @@ -14,6 +14,7 @@ @grid-ready="onGridReady" :defaultColDef="defaultColDef" :columnDefs="columnDefs" + :getRowId="params => params.data._id" :pagination="true" :paginationAutoPageSize=true :row-data="null" @@ -146,14 +147,14 @@ export default { }, handleReceiveMessage (event) { const eventData = parseEventData(event.data); - // TODO: Duplicate rows might be added. I don't want to seek for every row to be included, but use other ways that would never pull duplicate rows. - // Maybe it's still necessary to filter here, don't know yet. - this.gridApi.applyTransactionAsync({ - add: [eventData] - }, (res) => { - const rowNode = res.add[0] - this.gridApi.flashCells({ rowNodes: [rowNode]}); - }) + if (!this.gridApi.getRowNode(eventData._id)) { + this.gridApi.applyTransactionAsync({ + add: [eventData] + }, (res) => { + const rowNode = res.add[0] + this.gridApi.flashCells({ rowNodes: [rowNode]}); + }) + } }, handleReceiveFilters (event) { let data = parseEventData(event.data);