Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

DatePicker binding to Odata Model issue

$
0
0

Hi Everyone,

 

I'm having trouble figuring out how to bind data to my sap.m.DatePicker while using XML views.  From the example in the "SAPUI5 Explored" content, I see:

<DatePicker  id="DP4"  value="{path:'/dateValue', type:'sap.ui.model.type.Date', formatOptions: { style: 'medium'}}"  />

However, this is using a json model where they create a date using Date().  In my case, I have an Edm.DateTime value coming from an Odata service and can't seem to figure out how to bind it to my DatePicker. 

 

One thing I finally got to work for displaying the date was:

value="{path:'Tdate', formatter:'fnDateTimeFormatter'}"

With this formatter function:

function fnDateTimeFormatter(oValue){  if (oValue == undefined || oValue == "")  return;    var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern: "yyyy/MM/dd"});    //return oDateFormat.format(new Date(oValue));    return oDateFormat.format(oValue);
};

When the value was updated, though, it did not update the model.

 

Any help would be greatly appreciated!


Viewing all articles
Browse latest Browse all 8372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>