Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9656

Re: Get data from a sapui5 table......Urgent

$
0
0

try this..here i am trying display only one column..

createContent : function(oController) {

    

     var layout = new sap.ui.commons.layout.MatrixLayout('layout');   

     layout.setWidth('80%');   

      

     var rPannel = new sap.ui.commons.Panel('rPannel');             

      

     var rTitle = new sap.ui.commons.Title('rTitle');    

     rTitle.setText('NorthWind');    

     rPannel.setTitle(rTitle);    

      

     var oTable = new sap.ui.table.DataTable(); 

      

     oTable.addColumn( 

          new sap.ui.table.Column({ 

               label: new sap.ui.commons.Label({text: "Products"}), 

               template: new sap.ui.commons.TextField().bindProperty("value", "ProductID"), 

               sortProperty: "ProductID" 

     })); 

      

     oTable.addColumn( 

          new sap.ui.table.Column({ 

               label: new sap.ui.commons.Label({text: "Product Name"}), 

               template: new sap.ui.commons.TextField().bindProperty("value", "ProductName"), 

               sortProperty: "ProductName" 

     })); 

        

     oTable.addColumn( 

          new sap.ui.table.Column({ 

               label: new sap.ui.commons.Label({text: "Quantity Per Unit"}), 

               template: new sap.ui.commons.TextField().bindProperty("value", "QuantityPerUnit"), 

               sortProperty: "QuantityPerUnit" 

     })); 

      

     oTable.addColumn( 

          new sap.ui.table.Column({ 

               label: new sap.ui.commons.Label({text: "Unit Price"}), 

               template: new sap.ui.commons.TextField().bindProperty("value", "UnitPrice"), 

               sortProperty: "UnitPrice" 

     })); 

      

     oTable.addColumn( 

          new sap.ui.table.Column({ 

               label: new sap.ui.commons.Label({text: "Units In Stock"}), 

               template: new sap.ui.commons.TextField().bindProperty("value", "UnitsInStock"), 

               sortProperty: "UnitsInStock" 

     })); 

      

     oTable.addColumn( 

          new sap.ui.table.Column({ 

               label: new sap.ui.commons.Label({text: "Reorder Level"}), 

               template: new sap.ui.commons.TextField().bindProperty("value", "ReorderLevel"), 

               sortProperty: "ReorderLevel" 

     }));  

    

    

     //  http://demos.kendoui.com/service/Northwind.svc/

     var oModel = new sap.ui.model.odata.ODataModel( 

                                   "http://services.odata.org/V3/Northwind/Northwind.svc/",

                                                        true); 

     oTable.setModel(oModel); 

     oTable.bindRows("/Products"); 

    // oTable.bindRows("/Customers");

      

     rPannel.addContent(oTable);   

     layout.createRow(rPannel); 

      

     this.addContent(layout); 

 

 

      }


Viewing all articles
Browse latest Browse all 9656

Trending Articles



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