title: UI5 Tree Binding to JSON
body: <p>I have the following JSON file.</p>
  
  <pre><code>"idocs": [
  
  {
  
     "Docnum": "00063463",
  
     "Mestyp": "MATMAS",
  
     "Status": "53",   
  
     "Sndprn": "EXTSYS1",
  
     "Direct": "Inbound",
  
     "Message": "Material 00002342 Created",
  
     "messages":    [{                       
  
               "message": "Material 00002342 Created"                              
  
          }],
  
     "segments":     [{                       
  
                      "segment": "E1MARAM",
  
                      "fields":     [{                       
  
                                  "fieldName": "MATNR"                              
  
                           }]                                  
  
              }]                        
  
      }
  </code></pre>
  
  <p>I want to bind this to a tree node. I have the following code to "attempt" to do this and it is not doing anything. Not even an error.</p>
  
  <pre><code>var oTree = new sap.ui.commons.Tree("tree")
  
                                      .placeAt("idViewRoot--idViewDetail--toolBar-content");
  
  
  
                              oTree.bindAggregation("nodes", tgtPath, function(
  
                                      sId, oContext) {
  
  
  
                                  alert("stuff");
  
                                  var treePath = oContext.getPath();
  
                                  var bindTextName = '';
  
                                  if (treePath.indexOf("fields") !== -1) {
  
                                      bindTextName = "fieldName";
  
                                  } else {
  
                                      bindTextName = "segment";
  
                                  }
  
                                  return new sap.ui.commons.TreeNode()
  
                                          .bindProperty("text", bindTextName);
  
                              });
  </code></pre>
  
  <p>I would appreciate if someone could take a look and point me in the right direction.</p>
  
  <p>Should I see an alert "stuff" appearing, because I do not even see that. Could it be an issue with the binding.</p>
  
  <p>The value of tgtPath is /idocs/0/segments.</p>
  
  <p>Martin</p>