Skip to Content
author's profile photo Former Member
Former Member

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


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Oct 22, 2015 at 09:07 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 21, 2015 at 10:09 PM

    if setting editable="true" on the form is not a solution


    <Label class="alignedFormLabel"



    padding-top: 8px;!important;


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.