[SOLVED] 4.0 to 5.2 migration -- TypeError: Cannot set property 'id' of undefined when invoking gantt.init(/*host_id*/)

I’ve been in the process of migrating from 4.0 to 5.2. I’m working in a React environment and have dhtmlx gantt wrapped in a React component.

For some reason, whenever I invoke gantt.init(/*host_id*/), I’m getting the following TypeError:

from TypeError: Cannot set property 'id' of undefined

I wasn’t getting this error with 4.0. Has anyone encountered this issue before?

Thanks,

-testuser3

For anyone else facing this issue, it’s because layout config was added to dhtmlx in 5.0. Without having a layout defined gantt will fail on init.

Hello,
If you want to reinitialize Gantt, you need to specify the ID. It is true that the layout config was added in 5.x version. But Gantt should work correctly after gantt.init() command, if you specify the element correctly. Here is the demo:
https://files.dhtmlx.com/30d/b175681b33617d3422d17d8d683fac84/react+layout_config.zip
You can install 5.x version there:
https://docs.dhtmlx.com/gantt/desktop__install_with_bower.html#addingprofessionaleditionintoproject
Then try reinitializing Gantt using this command:
gantt.init('root')