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!