Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

DatePicker in Grid - Wrong Element/Format?

Hello Everyone,

I´ve got a Javascript-DateObject ("/Date(1354665600000)/") accessible via OData-Binding.

In my XMLView I have implemented a DatePicker with dateValue="{Birthday}" -- Birthday is the bound Object.

Another Property I configured is -editable="false"- because I just want to show the date.

Also I set displayFormat="dd.MM.yyyy".

Now I put everything into a grid to format the view. Code looks like this:


    defaultSpan="L12 M12 S12"















                      <Label text="{i18n>Birthday}">


                                <l:GridData span="L2 M2 S2"/>



                      <DatePicker dateValue="{Birthday}" editable="false" displayFormat="dd.MM.yyyy">


                                <l:GridData span="L10 M10 S10"/>







The problem now is that it looks like that:

Hopefully you can see that the date does not fit right into the grid-row. But the rest works perfectly.

How can I make it looking better?

Or can I use an other UI5-Element for the view of this date. (Without a formatter for example if you do it with a normal sap.m.Text)

Kind regards,

Jean-Luc Düe


Former Member

Hi Jean-Luc,

for displaying use a Text control and a data typr or formatter. In this JSBin see the second row with Label "Birthday 2" for an example.

If you use the DatePicker with editable ? "false" the label and the DatePicker are rendered at the top of the row and cause the DatePicker is higher than the label it does not look perfect.

So the trick is:

<Text text="{path: '/Birthday', type: 'sap.ui.model.type.Date'}">


              <l:GridData span="L5 M10 S7"/>



JS Bin on

Another solution:

Another solution would be to set the editable property of the SimpleForm to true and set it to false for all your controls in the form.

That way you could easily switch between display and edit mode by binding the editable property of your controls to a model property and just switching the model property.

Regards Helmut

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question