How to bring data to UI5 calendar widget
-
Christian
3 years ago #30088Hi all
I want to use the Calendar widget from UI5: https://openui5.hana.ondemand.com/1.71.0/#/api/sap.ui.unified.Calendar. According to the examples, it is possible to mark certain days with colors and tooltips (https://openui5.hana.ondemand.com/1.71.0/#/entity/sap.ui.unified.Calendar/sample/sap.ui.unified.sample.CalendarSpecialDaysLegend). Unfortunately, I do not understand how to bring this information into the Calendar component…
I tried to set the specialDates property, according to the UI5 docu:
var dates = [new sap.ui.unified.DateTypeRange({
startDate: new Date(‘0222-01-20T00:00:00’),
type: “Type01”,
tooltip: “Placeholder 1”,
color: “#ff00ff”
})];this.setItemValue(“Screen2”, “ui_unified_Calendar1”, “specialDates”, dates);
With this approach I get the error “Uncaught (in promise) Error: Property “specialDates” does not exist in Element sap.ui.unified.Calendar#Screen2–ui_unified_Calendar1″, even though it is there (see screenshot). The same goes with “specialDatesPath2.
There is also the property “specialDatesPath”, but here I guess I have to provide an expression where to find the special dates in the data model.
So, how to tackle this?
Thank you very much!
Attachments:
You must be logged in to view attached files.Christian
3 years ago #30096::I managed it on my own 🙂
In the Scripts snippet of the Process Designer, you can use the following line to access the calendar component:
var oCal1 = sap.ui.getCore().byId(“Screen1–ui_unified_Calendar1”);
Afterwards, you can use the code from the SAP example page. Even though this works I would like to know if this is the best approach to solve this.
Thank you!
You must be logged in to reply to this topic.