Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8545

Cant get To Run AggregationBinding Example :(

$
0
0

I am trying to run this example but some how just cant

 

<!DOCTYPE HTML>

<html>

  <head>

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

 

 

  <script src="resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

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

  data-sap-ui-theme="sap_goldreflection">

  </script>

  <!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->

 

 

  <script>

  $(document).ready(function()

  {

  var data =

  {

  company:

  {

  properties: [

                 {value: "Hello"},

                 {value: true},

                 {value: 45},

                ]

  }

  }

 

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

  oModel.setData(data);

 

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

 

  var oContainer = new sap.ui.core.ComponentContainer("oContainer", {

         name: "oContainer",

         settings: {text: "Hello World 2"}

     });

 

  alert("...");

 

  oContainer.bindAggregation("content", "/company/properties", function(sId, oContext)

  {

    var value = oContext.getProperty("value");

     switch(typeof value)

     {

         case "string":

             return new sap.ui.commons.TextField(sId, {

                 value: {

                     path: "value",

                     //type: new sap.ui.model.type.String();

                 }

             });

         case "number":

             return new sap.ui.commons.TextField(sId, {

                 value: {

                     path: "value",

                    // type: new sap.ui.model.type.Float();

                 }

             });

         case "boolean":

             return new sap.ui.commons.CheckBox(sId, {

                 checked: {

                     path: "value"

                 }

             });

     }

  });

  });

  </script>

 

 

  </head>

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

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

  </body>

</html>

 

After some debug via fireBug, I saw it threw errors with code lines that look like:

 

type: new sap.ui.model.type.

 

So I commented them out..

 

However theres another error now that says:

Aggregation "content" does not exist in Element sap.ui.core.ComponentContainer#oContainer



Whats it that I am doing wrong here...


Thanks for all your help ...


Amjad


Viewing all articles
Browse latest Browse all 8545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>