I am trying to add multiple sap.gantt.simple.GanttChartWithTable dynamically into a Gantt Chart Container. I have defined the empty Gantt chart container in my XML view and I want to create multiple sap.gantt.simple.GanttChartWithTable in my JavaScript controller and add them to the Gantt chart container.
I get the following error: **TypeError: **Cannot read properties of null (reading ‘getRowMode’)
Uncaught (in promise) TypeError: e is null
_updateRowHeightInExpandModel GanttChartWithTable-dbg.js:3632
I have the following code:
` <gnt2:GanttChartContainer id="ganttContainer">
<gnt2:toolbar>
<gnt2:ContainerToolbar id="toolbar1" design="Auto" showBirdEyeButton="true" showLegendButton="true" ganttSidePanel="onGanttSidePanel"
showSearchButton="false" showDisplayTypeButton="true"
</gnt2:ContainerToolbar>
</gnt2:toolbar>
>
</gnt2:GanttChartContainer>`
JavaScript Controller:
onInit: function () {
var oGanttContainer = this.getView().byId("ganttContainer");
var oGanttChart = new sap.gantt.simple.GanttChartWithTable(
);
oGanttContainer.addGanttChart(oGanttChart);
},
If I try as follows, I get the same error:
var oGanttChart = new GanttChartWithTable({
enableChartOverflowToolbar: true
});
oGanttContainer.addGanttChart(oGanttChart);
frozen_ky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.