TypeError: Cannot read property '$config' of undefined
For DHTMLX Gantt: Version 7.1.2, Standard Edition
When I execute: gantt.parse(tasks);
The console shows the following error: TypeError: Cannot read property '$config' of undefined
The error occurs at this section of the code
line: 13213
for (var i = 0; i < verticalViews.length; i++) {
for (var j = 0; j < horizontalViews.length; j++) {
**if (verticalViews[i].$config.id && verticalViews[j].$config.id && verticalViews[i].$config.id === verticalViews[j].$config.id) {**
commonViews.push(verticalViews[i].$config.id);
}
}
}
The verticalViews array goes out of bounds when using the horizontalViews' index j.
The layout that we are using is:
gantt.config.layout = {
css: "gantt_container",
rows: [
{
cols: [
{view: "grid", id: "grid", group: "grids", scrollX: "scrollHor", scrollY: "scrollVer"},
{resizer: true, width: 1},
{view: "timeline", id: "timeline", scrollX: "scrollHor", scrollY: "scrollVer"},
{view: "scrollbar", id: "scrollVer"}
]
},
{resizer: true, width: 1},
{
cols: [
{view: "grid", group: "grids", bind: gantt.config.resource_store, config: resourceGridConfig, scrollX: "scrollHor", scrollY: "resourceVScroll"},
{resizer: true, width: 1},
{view: "timeline", bind: gantt.config.resource_store, layers: resourceLayers, scrollX: "scrollHor", scrollY: "resourceVScroll"},
{view: "scrollbar", id: "resourceVScroll"}
]
},
{view: "scrollbar", id: "scrollHor"}
]
};
Also seeing a similar issue within trial of 7.1.3 Pro in the "scrollTo" function. Same issue, length of one array is used as index into a smaller array.
I changed a bunch of things trying to fix it, I think removing the scrollX: "scrollHor" from the first col of the first row fixed it for me.
I was using the config from an old version so I'm not sure if something was deprecated.
@tarokobear and @iadaz, we are aware of that issue. It occurs because the scrollbar is attached to more than 2 views. If you set a different name, the issue shouldn't occur:
http://snippet.dhtmlx.com/5/a20ef712b
The dev team will fix that bug in the future, but I cannot give you any ETA.
@tarokobear and @iadaz, The dev team fixed the bug for the scrolbar if it is attached to 3 or more views: https://docs.dhtmlx.com/gantt/whatsnew.html#719 You can see that the issue is no longer reproduced in the following sample: https://snippet.dhtmlx.com/5/6aecbdfdc