Skip to Content
0

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

Oct 17, 2017 at 07:05 PM

84

avatar image
Former Member

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 :

Former Member to use CalendarDefs

SAPUI5 - GANTT - Calendar in backround - CalendarDef max. amount of Dates is 100 by Björn 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"


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Stephan Pichler Dec 12, 2017 at 12:50 PM
0

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


require-defs.png (6.5 kB)
Share
10 |10000 characters needed characters left characters exceeded