Quantcast
Viewing all articles
Browse latest Browse all 9656

Re: OData model and associations

Hi Steven,

 

I am not sure why you want to build a url. The ODataModel works with contexts and paths.

 

eg if we bind 'ProductFamily('XBOX360')/Description' to TextField Value and it will show 'XBOX 360'

 

similarly we can bind  'ProductFamily('XBOX360')/ContainsMaterials' to a table and it will show all the associated Materials of an Xbox

 

One way to do this is described in the developer guide, use of "expand" to inline the contents of the association when binding

https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/ODataModel.html

oControl.bindElement("/Category(1)", {expand: "Products"}); 

oTable.bindRows({
    path: "/Products",    parameters: {expand: "Category"}
});

 

Another way

 this.oModel = this.model = new sap.ui.model.odata.ODataModel(sServiceUrl, true, user, pwd);
var oContext = this.oModel.getContext("/ProductFamily('XBOX360')");
..
sap.ui.getCore().byId("tblMaterials").bindRows(oContext + '/ContainsMaterials');

 

Cheers

jsp


Viewing all articles
Browse latest Browse all 9656

Trending Articles



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