Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

When to not use sap.m.DatePicker: How to cleanly pick a month instead of a date

$
0
0

Hello fellow SAPUI5

 

A quick tip regarding input fields and dates. (I was about to ask this as a question, but found the answer myself; so decided instead to just post it as a tip for fellow SAPUI5 learners.) I was trying to have an input field that allows a user to select a date as a month.

 

I used a sap.m.DatePicker with the displayFormat as below.

 

0001.png

This worked well enough; the DatePicker field showed the date as expected and is treated as I wanted.

 

 

0002.png

 

However I still had to click down to the day in the picker view:

0003.png

 

For example, I still had to click all the way through to 16th (or whatever) April 2015 to select April 2015. One extra click felt inelegant, how could I avoid it?

 

It turns out that using sap.m.DateTimeInput was the more correct choice in this instance!

 

0001b.PNG

 

leads to:

0004.png

 

No doubt not much of an observation to our UI5 veterans, but a learning item for me!


Viewing all articles
Browse latest Browse all 6178

Trending Articles