on 06-20-2019 9:01 AM
UI5 has a date picker controller sap.m.DatePicker, the problem is that this controller by default has no Today button, which will automatically select today's date.
Is there any way to add Today-button to sap.m.DatePicker?
As of 1.95.0, there is no need to invent a wheel, there is a standard property called showCurrentDateButton.
Sample, please, have a look on the "DatePicker with non-working days - 05.11.2015 - 25.11.2015 and with shortcut for today" case.
For those, who is below the 1.95.0, the Konchada's answer is a great solution!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
We have same requirement and on search came to this old thread, however following some of the other experts advise we extended and added the today button as below.
For this we extended DatePicker, Calender & Calender renderer. and with a new attribute "showTodayButton" on date picker, so this button is displayed only where requested.
Calender.js
CalenderRenderer.js
DatePicker.js-->_createPopupContent
Hope this helps you guys.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi MIke,
there are many method to do that, but custom.
Maybe the easily one is :
View
<DatePicker id="TodayPicker" value="{yourbinding}" />
<Button text="Today" press="onPress"/>
Controller
onPress : function ( oEvent ) {
this.getView().byId("TodayPicker").setDateValue(new Date());
}
Regards,
Sebastiano
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.