gantt icon indicating copy to clipboard operation
gantt copied to clipboard

TypeError: Cannot read property '$config' of undefined

Open tarokobear opened this issue 4 years ago • 2 comments

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"}
					]
				};

tarokobear avatar May 26 '21 00:05 tarokobear

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.

iadaz avatar Jun 10 '21 14:06 iadaz

@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.

gearcoded avatar Sep 06 '21 09:09 gearcoded

@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

gearcoded avatar Oct 28 '22 07:10 gearcoded