[email protected]
Posts: 65
Joined: Fri Aug 26, 2022 9:33 am

Can't call parent by ID if the ID is different than name

Hello,
Why I cannot call parent if the ID of parent is different than NAME of parent?


My code:

series: [{
name: 'Project 1',
data: [{
id: 1,
name: 'Planning',
collapsed: false,
completed: 0.80,
start: today.getTime(),
end: today.getTime() + (20 * day)
}, {
name: 'Requirements',
id: 1,
parent: 1,
completed: 1,
start: today.getTime(),
end: today.getTime() + (5 * day)
}
] }]
});


ERROR

Logger.js:503 [2022-08-27T21:53:19.416Z]: Cannot read properties of undefined (reading 'push')
TypeError: Cannot read properties of undefined (reading 'push')
at https://code.highcharts.com/gantt/highc ... js:648:475
at Array.forEach (<anonymous>)
at https://code.highcharts.com/gantt/highc ... js:648:449
at Array.forEach (<anonymous>)
at B (https://code.highcharts.com/gantt/highc ... js:648:386)
at Object.getTree (https://code.highcharts.com/gantt/highc ... .js:650:44)
at B (https://code.highcharts.com/gantt/highc ... js:661:255)
at https://code.highcharts.com/gantt/highc ... js:664:395
at Array.forEach (<anonymous>)
at n.p (https://code.highcharts.com/gantt/highc ... js:663:361)
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Can't call parent by ID if the ID is different than name

Hi [email protected]!
Thanks for contacting us with your question!

That's because id property should be a string type, not a number - same with parent property. Also, id should be a unique identifier, so you shouldn't use it on a few points.

Demo: https://jsfiddle.net/BlackLabel/gtwupdqL/
API Referecnce: https://api.highcharts.com/gantt/series.gantt.data.id
https://api.highcharts.com/gantt/series ... ata.parent

Let me know if you have any further questions.
Regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Gantt”