Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Expression '{...}' instead of value...

Hello!

Again I ask to help to understand the problem ...

Please look at the code below:

<!DOCTYPE HTML>

<html>

  <head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

  <meta http-equiv="Cache-Control" content="no-cache">

  <title>DynamicTable</title>

  <script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.m"

  data-sap-ui-theme="sap_bluecrystal"

  data-sap-ui-resourceroots='{"sap.ui.sample": "./"}'>

  </script>

  <script type="text/javascript">

  sap.ui.getCore().attachInit(function () {

  var model_structure = {

  output:{

       groups:[

            {group_id:"1", name:"Group-1"},

            {group_id:"2", name:"Group-2"}

       ],

      columns:[

            {id:"col1", name:"Column-1"},

            {id:"col2", name:"Column-2"}

       ],

       lines:[

            {col1:"1.1", col2:"1.2", group_id:"1"},

            {col1:"2.1", col2:"2.2", group_id:"1"},

            {col1:"3.1", col2:"3.2", group_id:"2"}

       ]

  }

};

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

  sap.ui.getCore().setModel(o_model, "data");

  var o_list_items;

  var o_table;

  o_list_items = new sap.m.ColumnListItem({

       cells: {

            path: "data>/output/columns",

            template: new sap.m.Text({

                 text: {

                      path: "data>id",

                      formatter: function(value){return '{data>'+value+'}';}

                 }

            })

       }

  });

  o_table = new sap.m.Table({

       columns: {

            path: 'data>/output/columns',

            template: new sap.m.Column({

                 header: new sap.m.Text({text: "{data>name}"})

            })

       },

       items: {path: "data>/output/lines", template: o_list_items},

  });

  var app = new sap.m.App("App", {

       initialPage: "page1"

  });

  var page1 = new sap.m.Page("page_dynamic_table", {

       title : "DynamicTable",

       showNavButton : false,

       content : [ o_table ]

  });

  app.addPage(page1);

  app.placeAt("content");

  });

  </script>

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html>

When creating a table, I add aggregation 'items' (line 63). However, for some reason, are displayed in the table cell expression '{data> ...}'. In the place they need to put a value from the model.

Tell me, please, why is this happening? What am i doing wrong?

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question