天天看點

SAP UI5 Demo 綁定…

Create a project

SAP UI5 Demo 綁定…
SAP UI5 Demo 綁定…
SAP UI5 Demo 綁定…
SAP UI5 Demo 綁定…
SAP UI5 Demo 綁定…

Index内添加代碼,尤其注意一點兒,libs 内需要手動加上 sap.ui.table

SAP UI5 Demo 綁定…

代碼如下

            <script>

            //create model

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

            oModel.loadData("./json/data.json");

             sap.ui.getCore().setModel(oModel);

            //create tabel

            oTable = new sap.ui.table.Table({title:"Demo Date"});

            //add column

            oColID = new sap.ui.table.Column({

                label : "ID",

                template : 'ID'

            });

            oColName = new sap.ui.table.Column({

                label : "Name",

                template : "NAME"

            });

            oColAge = new sap.ui.table.Column({

                label : "Age",

                template : "AGE"

            });

            oTable.addColumn(oColID);

            oTable.addColumn(oColName);

            oTable.addColumn(oColAge);

            oTable.setModel(oModel);

            oTable.bindRows("/data");

            oTable.placeAt("content");

        </script>

SAP UI5 Demo 綁定…

另外,可以不适讀檔案,直接從代碼裡定義

SAP UI5 Demo 綁定…