svelte-gantt
svelte-gantt copied to clipboard
Cannot use updateRow or updateRows method to add add rows with children
When using updateRow
or updateRows
to add rows with child rows it seems that these are not correctly added.. I get a row label of undefined
and then when adding tasks for these rows via updateTasks
I get the following error:
TypeError: Cannot read properties of undefined (reading 'y')
It seems that the y
value might not be set for these new rows?
Adding child rows does work when using gantt.$set({rows})
. I also tested adding these rows all as parent/top-level rows via updateRow
and updateRows
and they worked fine, all tasks were added correctly with updateTasks
.
I see that the updateRow
and updateRows
methods call rowFactory.createRow(model, null)
where null
is the Y value: https://github.com/ANovokmet/svelte-gantt/blob/773a6a9621c3cd4675854608f8d9400ba68a1a02/packages/svelte-gantt/src/Gantt.svelte#L676-L683
But the initRows
logic is different calls rowFactory.createRows(rows)
: https://github.com/ANovokmet/svelte-gantt/blob/773a6a9621c3cd4675854608f8d9400ba68a1a02/packages/svelte-gantt/src/Gantt.svelte#L461-L465
It seems that rowFactory.createRows
is the only method that ever calls rowFactory.createChildRows
: https://github.com/ANovokmet/svelte-gantt/blob/773a6a9621c3cd4675854608f8d9400ba68a1a02/packages/svelte-gantt/src/core/row.ts#L59-L65