Main grid: fix row referencing, do not add duplicate rows

This commit is contained in:
Erki Aas 2022-11-09 11:28:08 +02:00
parent dc74e78d4b
commit ebcac70341
2 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,6 @@
import ComboboxFilter from "../../Filter/ComboboxFilter";
const config = {
getRowId: params => params.data._id,
defaultColDef: {
width: 120,
initialPinned: true,

View File

@ -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);