zoukankan      html  css  js  c++  java
  • ui5 load josn

    sap.ui.jsview("ui5p.Test01", {
    
        /** Specifies the Controller belonging to this View. 
        * In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
        * @memberOf ui5p.Test01
        */ 
        getControllerName : function() {
            return "ui5p.Test01";
        },
    
        /** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed. 
        * Since the Controller is given to this method, its event handlers can be attached right away. 
        * @memberOf ui5p.Test01
        */ 
        createContent : function(oController) {
             
            var mtable=new sap.ui.table.Table('mtable',{title:'testtable'});
        
            mtable.addColumn(new sap.ui.table.Column({
                label: new sap.ui.commons.Label({text: "Last Name"}), 
                template: new sap.ui.commons.TextView({text:"{lastName}"})
              }));
            
             // create some local data
              var naughtyList = [
                {lastName: "Dente", name: "Al", stillNaughty: true},
                {lastName: "Friese", name: "Andy", stillNaughty: true},
                {lastName: "Mann", name: "Anita", stillNaughty: false}
              ];    
    
              var oModel = new sap.ui.model.json.JSONModel();    
              //type 1
              //oModel.loadData("http://localhost:8080/UI5P/ui5p/data01.json");
              
              //type 2
              oModel.loadData("./ui5p/data01.json");
              
              //type 3
              //oModel.setData(naughtyList);
              
              mtable.setModel(oModel);
              mtable.bindRows("/");
            
            return mtable;
        }
    
    });
    data01.json 文件内容
    
    [
    {"lastName": "Dente", "name": "Al"},
    {"lastName": "Friese", "name": "Andy"},
    {"lastName": "Mann", "name": "Anita"}
    ]
  • 相关阅读:
    用nginx解决前端跨域问题
    vue中router-link的详细用法
    leetcode 148 排序链表
    leetcode 146 LRU缓存机制
    leetcode 101 对称二叉树
    leetcode 84 柱状图中最大的矩形
    leetcode76 最小覆盖子串
    C++ map, unordered_map
    python随机函数
    丑数
  • 原文地址:https://www.cnblogs.com/rojas/p/8426085.html
Copyright © 2011-2022 走看看