Hello SAPUI5 people,
I want to populate generic tiles with data from backend using odata service, can anyone guide me how to do this?
I am a beginner so do not have any idea about populating tiles with data coming from backend.
Thank you,
Regards,
Chetna
copy paste this code in the createcontent method.
var oModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V3/(S(hwii2w0uoa1wgczn3bian230))/OData/OData.svc/"); oModel.oHeaders = { "DataServiceVersion" : "3.0", // first check the oModel data version, since we are using data version 3 in the // in the service URL that we are accessing, we set out oModel version from 2 to 3 "MaxDataServiceVersion": "3.0" // if not we get an error }; sap.ui.getCore().setModel(oModel); var tileContainer = new sap.m.TileContainer("tileid",{ height: '300px', tiles : [ new sap.m.CustomTile({ content: new sap.m.Text({text: 'Sample example'}) }) ] }); // var tile = sap.ui.getCore().byId("tileid"); tileContainer.setModel(oModel); var template = new sap.m.StandardTile({ title : "{Name}" }); tileContainer.bindAggregation( 'tiles', '/Products',template ); tileContainer.placeAt('content');
like this
Add a comment