Reputation: 175
How to set (customize) first day of week in sap.m.DatePicker
's calendar? I can change the first day of week in sap.ui.unified.calendar
, but not for sap.m.DatePicker
? Any ideas? I have my sample SAPUI5 plnkr
.
Upvotes: 1
Views: 2673
Reputation: 386
If you want to set it for all date pickers in your application you can do the following:
sap.ui.core.LocaleData.getInstance(sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale()).mData["weekData-firstDay"] = 1;
see https://archive.sap.com/discussions/message/15733085#15733085
There may be a way to set this for all apps under Fiori Launch Pad but I have not found that trick.
Upvotes: 1
Reputation: 331
I meet the same problem and I resolved it extending (see also this tutorial to extend ui5-control) sap.m.DatePicker in order to create a new one. Then I have extended _createPopupContent method in the following manner:
MyNewDatePicker.prototype._createPopupContent = function() {
DatePicker.prototype._createPopupContent.call(this);
...
this._oCalendar.setFirstDayOfWeek(1);
};
Upvotes: 1
Reputation: 53
you can access the internal calendar in your handleChange function via:
handleChange: function(evt){
evt.oSource._oCalendar.setFirstDayOfWeek(1);
}
But this is not the way it meant to be accessed. There is no official way to access the internal calendar of the Datepicker. So my advise would be to open up a feature request on openui5 via github https://github.com/SAP/openui5/ .
Upvotes: 1