Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Building path for OData entity with Edm.DateTime as key field

$
0
0

Hi,

 

I have an entity which has one of its key fields of type Edm.DateTime (TIMESTAMP on the ABAP backend).

 

In my UI5 code I want to bind one entity of which I know the key fields like this:

 

var oChDateTime = new Date(1436109229000);
// toJSON returns "2015-07-05T15:13:49.000Z" so we must strip the last 4 characters and URI encode the whole thing
var sPath = "/MyEntitiySet(Id='0815',ChDateTime=datetime'" + encodeURI(oChDateTime.toJSON().substr(0, 19)) + "')";
oView.bindElement(sPath);

 

Isn't there a more elegant way of handling these Edm.DateTime fields?


Viewing all articles
Browse latest Browse all 6178

Trending Articles



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