cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Gantt Chart - Unable to instantiate object for sap.gantt.def.cal for Calendar Defaults

Former Member
0 Kudos

I imported the sample Gantt Chart application Gantt Chart Sample and started off tweaking it to suit my needs in the SAP WebIDE.
One of the change I was trying to make is to mark holidays in the Calendar. Going through SCN for a way to implement I came across the following 2 threads on this :

Gantt Chart in SAP UI5 – Drag and Drop functionality between 2 Charts - Comment by bhoomika.jain to use CalendarDefs

SAPUI5 - GANTT - Calendar in backround - CalendarDef max. amount of Dates is 100 by bjoern.burandt

The problem here is I am unable to instantiate the necessary classes for the same.

I started off trying to instantiate for sap.gantt.def.cal.TimeInterval using following code in onInit method of BasicGanttChart.controller.js ( after

oGanttChartWithTable.setSelectionMode(sap.gantt.SelectionMode.Multiple) )


var timeIntTemplate = new sap.gantt.def.cal.TimeInterval({
startTime: "20170201080000",
endTime: "20170301160000"
});


But this is throwing error in chrome debugger :

Uncaught TypeError: Cannot read property 'TimeInterval' of undefined

If I check in debugger - sap.gantt.def.cal is not defined and if I check sap.gantt.def I only see SvgDefs and filter and nothing more:

Please help as to how to overcome this issue.


The sapui5 library I am using is :

src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"


Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Ashutosh Jha,

try adding the following lines before instantiating the defs.

If this is gonna work, put those lines at the beginning of your controller in order to make it possible for the component-preload.js to request the libs..

Best regards,

Stephan