How to bind the odata services to SAP ui5 table

2020-11-27 15:50:07 浏览数 (1)

代码语言:javascript复制
//Creating the instance of oData model
var oModel = new sap.ui.model.odata.v2.ODataModel("http://admin-think:88/sap/...",{useBatch : true});
sap.ui.getCore().setModel(oModel,"model1");
console.log(oModel);

// Create instance of table 
var oTable = new sap.ui.table.Table({
    visibleRowCount : 6,
        selectionMode: sap.ui.table.SelectionMode.Single, 
        navigationMode: sap.ui.table.NavigationMode.scrollbar, 
        selectionBehavior: sap.ui.table.SelectionBehavior.RowOnly
    });

  // First column "Application"
    oTable.addColumn(new sap.ui.table.Column({
           label : new sap.ui.commons.Label({
                 text : "APPLICATION",
                 textAlign : "Center",

           }),
           template : new sap.ui.commons.TextView({
                textAlign:"Center"}).bindProperty("text","model1>Applno"),              
    }));

    // Bind model to table control
    oTable.bindRows("model1>/");

0 人点赞