0
votes

I am trying to access the single day elements of a calender element. The IDs of those elements are generated. I tried sap.ui.getCore().byId() as well as this.getView().byId() but both options didn't work. Only the calendar element has some static ID.

By using jQuery.sap.byId("__component0---calendar--calendar1--Month0-20181212")[0] I get some result but I am not able to add a style class:

jQuery.sap.byId(...)[0].addStyleClass is not a function

enter image description here

Is there some way to add the style class?

2

2 Answers

1
votes

You can get your element from the DOM with jQuery:

$("__component0---calendar--calendar1--Month0-20181212")[0]

You can change and remove classes by using the jQuery methods .addClass() and .removeClass()

0
votes

I found some solution:

jQuery.sap.byId("__component0---calendar--calendar1--Month0-20181212").addClass("dateBackgroundChHa");

Let me know if there is some better way!