Quantcast
Channel: SCN: Message List - SAP Manufacturing Integration and Intelligence (SAP MII)
Viewing all articles
Browse latest Browse all 4841

Re: SAP MII/SAPUI5 using ODataModel with a Table

$
0
0

Hi Jacob,

 

You could try the below snippet:

In the example below columns get bound dynamically with the columns in the query result. If you already know the columns to be mapped then you could chose the columns to bind individually.

 

 

var oDataURL = "http://server:port/XMII/IlluminatorOData?QueryTemplate=ODataTest/messages";

 

var oModel = new sap.ui.model.odata.ODataModel(oDataURL, true);

 

var oTable = new sap.ui.table.DataTable({

id : "queryTable",

title: "MII Query Data",

width : "100%",

selectionMode : sap.ui.table.SelectionMode.Single});

 

//Table Column Definitions

    var oMeta = oModel.getServiceMetadata();

          var oControl;

         

     for ( var i = 0; i < oMeta.dataServices.schema[0].entityType[2].property.length; i++) {

     var property = oMeta.dataServices.schema[0].entityType[2].property[i];

    

           oControl = new sap.ui.commons.TextField().bindProperty("value",property.name);

           oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: property.name}), template: oControl}));

       }

 

var oTable = sap.ui.getCore().byId("queryTable");

oTable.setModel(oModel);

 

//Bind the Data to the Table

oTable.bindRows("/Rowset(QueryTemplate='ODataTest/messages',RowsetId=1)/Row");

 

oTable.placeAt('tableId');

 

 

Hope this helps!

 

Thanks and Best Regards,

Ria


Viewing all articles
Browse latest Browse all 4841

Trending Articles



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