3

<!DOCTYPE html>
<html>
<head>
 <!-- Load UI5, select gold reflection theme and the "commons" and "table"  control libraries -->
<script id="sap-ui-bootstrap"
     type="text/javascript"
      src="https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js"
     data-sap-ui-theme="sap_bluecrystal"
     data-sap-ui-libs="sap.ui.commons,sap.ui.table"></script>

<script>
jQuery.ajax({
    url: "/XMII/Illuminator?QueryTemplate=ZTest/QueryTemplates/table%20list&content-type=text/json",
    dataType: "json",
    success: function(data, textStatus, jqXHR) { // callback called when data is received
        var jsonModel = new sap.ui.model.json.JSONModel();
        jsonModel.loadData(data);
        sap.ui.getCore().setModel(jsonModel);

        var weatherTable = new sap.ui.table.Table({
            title : "Current Weather Details",
            visibleRowCount : 20
        });

        weatherTable.addColumn(new sap.ui.table.Column({
            label : new sap.ui.commons.Label({text : "Tablename"}),               
            template : new sap.ui.commons.TextView().bindText("TableName")                
        }));

        var oModel1 = new sap.ui.model.json.JSONModel();  

        var aData = jsonModel.getProperty("/Rowsets/Rowset/Row");            
        oModel1.setData({modelData : aData});            
        weatherTable.setModel(oModel1);  
        weatherTable.bindAggregation("rows","/modelData");  
        weatherTable.placeAt('content'); 


        var dataLayout = new sap.ui.layout.HorizontalLayout({
            id : "dataLayout", // sap.ui.core.ID                
        });

        var Tablename = new sap.ui.commons.TextView({
            id : "Tablename",
            text : '{TableName}'
        })

        dataLayout.addContent(Tablename);
        dataLayout.placeAt("content");
    }
});
</script>

</head>
<body class='sapUiBody'>
    <div id='content'></div>
</body>
</html>
|
  • 2