Skip to Content
1

Datepicker pattern from Model

Dec 12, 2016 at 09:27 AM

78

avatar image
Former Member

Hi!

How can I define a pattern dynamic from a model?

For example I have this DatePicker:

The value off STORE_VAL_DATE_FROM is "20160724"

<DatePicker
                                value="{
                                    path:'STORE_VAL_DATE_FROM',
                                    type: 'sap.ui.model.type.Date',
                                    formatOptions:{
                                        source: {
                                            pattern: 'yyyyMMdd'
                                        },
                                        pattern: 'dd/MM/yyyy'
                                    }
                                }"
                            />

This works OK!

I want the pattern (dd/MM/yyyy) to be dynamic.

I Tried this but no works:

The value /USERINFO/USER_DATE_FORMAT is "dd/MM/yyyy"

<DatePicker
                                value="{
                                    path:'STORE_VAL_DATE_FROM',
                                    type: 'sap.ui.model.type.Date',
                                    formatOptions:{
                                        source: {
                                            pattern: 'yyyyMMdd'
                                        },
                                        pattern: '/USERINFO/USER_DATE_FORMAT'
                                    }
                                }"
                            />

How can I resolve this?

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Dec 13, 2016 at 03:14 PM
0

Hi Puig,

I think pattern allows only the date patterns like "mmddyyyy" or "dd/mm/yyyy"

I am expecting that u can't use like this

pattern:'/USERINFO/USER_DATE_FORMAT'

Thanks,

Deepak.

Share
10 |10000 characters needed characters left characters exceeded