Main grid: fix row referencing, do not add duplicate rows
This commit is contained in:
		| @@ -1,7 +1,6 @@ | |||||||
| import ComboboxFilter from "../../Filter/ComboboxFilter"; | import ComboboxFilter from "../../Filter/ComboboxFilter"; | ||||||
|  |  | ||||||
| const config = { | const config = { | ||||||
|     getRowId: params => params.data._id, |  | ||||||
|     defaultColDef: { |     defaultColDef: { | ||||||
|         width: 120, |         width: 120, | ||||||
|         initialPinned: true, |         initialPinned: true, | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ | |||||||
|       @grid-ready="onGridReady" |       @grid-ready="onGridReady" | ||||||
|       :defaultColDef="defaultColDef" |       :defaultColDef="defaultColDef" | ||||||
|       :columnDefs="columnDefs" |       :columnDefs="columnDefs" | ||||||
|  |       :getRowId="params => params.data._id" | ||||||
|       :pagination="true" |       :pagination="true" | ||||||
|       :paginationAutoPageSize=true |       :paginationAutoPageSize=true | ||||||
|       :row-data="null" |       :row-data="null" | ||||||
| @@ -146,14 +147,14 @@ export default { | |||||||
|     }, |     }, | ||||||
|     handleReceiveMessage (event) { |     handleReceiveMessage (event) { | ||||||
|       const eventData = parseEventData(event.data); |       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. |       if (!this.gridApi.getRowNode(eventData._id)) { | ||||||
|       // Maybe it's still necessary to filter here, don't know yet. |  | ||||||
|         this.gridApi.applyTransactionAsync({ |         this.gridApi.applyTransactionAsync({ | ||||||
|           add: [eventData] |           add: [eventData] | ||||||
|         }, (res) => { |         }, (res) => { | ||||||
|           const rowNode = res.add[0] |           const rowNode = res.add[0] | ||||||
|           this.gridApi.flashCells({ rowNodes: [rowNode]}); |           this.gridApi.flashCells({ rowNodes: [rowNode]}); | ||||||
|         }) |         }) | ||||||
|  |       } | ||||||
|     }, |     }, | ||||||
|     handleReceiveFilters (event) { |     handleReceiveFilters (event) { | ||||||
|       let data = parseEventData(event.data); |       let data = parseEventData(event.data); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user