diff --git a/web/src/components/RealtimeTable/utils/cellUtils.js b/web/src/components/RealtimeTable/utils/cellUtils.js index 304a8ab..6609f72 100644 --- a/web/src/components/RealtimeTable/utils/cellUtils.js +++ b/web/src/components/RealtimeTable/utils/cellUtils.js @@ -1,3 +1,5 @@ +import { getDataRowId } from "./rowUtils"; + export function setNewValueToData(data, colId, rowId, value) { let targetObject = data; if (rowId && rowId.length) { @@ -167,8 +169,9 @@ export function deleteRow(data, lineId) { function findAndDelete(rows) { for (let i = 0; i < rows.length; i++) { const row = rows[i]; + const rowId = getDataRowId(row.data); - if (row.data.line_id == lineId) { + if (rowId == lineId) { rowDeleteSortOrder = row.sort_order; rows.splice(i, 1); i--; @@ -179,7 +182,7 @@ export function deleteRow(data, lineId) { } if (row.subRows && Array.isArray(row.subRows) && row.subRows.length > 0) { - const found = findAndDelete(row.subRows); + findAndDelete(row.subRows); } } } diff --git a/web/src/components/RealtimeTable/utils/rowUtils.js b/web/src/components/RealtimeTable/utils/rowUtils.js index 5ba9a51..1f43dc3 100644 --- a/web/src/components/RealtimeTable/utils/rowUtils.js +++ b/web/src/components/RealtimeTable/utils/rowUtils.js @@ -1,5 +1,9 @@ +export function getDataRowId(data) { + return data?.id || data?.line_id; +} + export function getRowId(row) { - return row.original.data.id || row.original.data.line_id; + return getDataRowId(row.original.data); } export function isVspRow(row) {