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"}
    ]
  • 相关阅读:
    识人高招:六招看清一个人
    让工作变简单的10种技巧
    推销中的五大提问技巧
    给初次签约大学生的忠告
    只要有钱50岁男人也嫁
    我老公一个月赚15000,但是幸福在哪呢?(转载)
    想法简单,生命更宽!
    中国经典到吐血的谎话
    你的思想是你最大的敌人
    完美人生从哪里起步
  • 原文地址:https://www.cnblogs.com/rojas/p/8426085.html
Copyright © 2011-2022 走看看