title: SAPUI5 Complex data binding example with DropdownBox in XML view
body: <p>I built this JSON (tested as valid) (.. don't mind that men and women are named the same here :-)):  </p>
  
  <pre><code>{
      "staff": {
          "berlin": [{
              "male": [
                  {"firstName": "Lasse", "lastName": "Larsson"},  
                  {"firstName": "Gerrit", "lastName": "Gartner"}
              ],
              "female": [
                  {"firstName": "Lasse", "lastName": "Larsson"},  
                  {"firstName": "Gerrit", "lastName": "Gartner"}
              ]
          }],
          "paris": [{
              "male": [
                  {"firstName": "Lasse", "lastName": "Larsson"},  
                  {"firstName": "Gerrit", "lastName": "Gartner"}
              ],
              "female": [
                  {"firstName": "Lasse", "lastName": "Larsson"},  
                  {"firstName": "Gerrit", "lastName": "Gartner"}
              ]
          }],
          "oslo": [{
              "male": [
                  {"firstName": "Lasse", "lastName": "Larsson"},  
                  {"firstName": "Gerrit", "lastName": "Gartner"}
              ],
              "female": [
                  {"firstName": "Lasse", "lastName": "Larsson"},  
                  {"firstName": "Gerrit", "lastName": "Gartner"}
              ]
          }]
      }
  }
  </code></pre>
  
  <p>In my controller I set the JSON model to the whole view like this:</p>
  
  <pre><code>// init instance of JSON model
  this.staffData = new sap.ui.model.json.JSONModel();
  // load JSON file into model
  this.staffData.loadData("ajax-dummy/staff.json");
  // bind model to whole view 
  this.getView().setModel(this.staffData);
  </code></pre>
  
  <p>In my XML view I would now like to dynamically build a (nested) DropdownBox 
  which should make me select e.g. 
  berlin->male->lastName
  So I need 3 levels of ListItems.</p>
  
  <p>The first problem is: I could generate this with JS (build one Listitem for each
  key in the staff object etc.) but I have no idea how to deal with this in the XML view.
  It looks like this at the moment:</p>
  
  <pre><code>&lt;content&gt;
  &lt;DropdownBox id="dd-locations" editable="true"&gt;
  &lt;core:ListItem text="{/staff/berlin}"&gt;&lt;/core:ListItem&gt;
  &lt;/DropdownBox&gt;
  &lt;/content&gt; 
  </code></pre>
  
  <p>And it displays (of course) just <em>"{object ..}"</em> in den DropdownBox, because it IS an object. </p>
  
  <p>Is this even possible to build within the XML view with data binding? Or is there a better way to structure
  the JSON? I know the ListItems need an array... And finally:  How can I nest the ListItems? Is there a better Control
  then DropdownBox I should use?</p>
  
  <p>EDIT: 
  What I want to have is "just" nesting Listitems like I could in HTML. I tried e.g.:</p>
  
  <pre><code>&lt;ComboBox&gt;
                              &lt;items&gt;
                                  &lt;core:ListItem key="key2" text="text2"/&gt;
                                  &lt;core:ListItem key="key3" text="text2"&gt;
                                      &lt;ComboBox&gt;
                                          &lt;items&gt;
                                              &lt;core:ListItem key="key4" text="text3"/&gt;
                                              &lt;core:ListItem key="key5" text="text3"/&gt;
                                              &lt;core:ListItem key="key6" text="text3"/&gt;
                                           &lt;/items&gt;
                                      &lt;/ComboBox&gt;
                                  &lt;/core:ListItem&gt;
                                  &lt;core:ListItem key="key4" text="text2"/&gt;
                               &lt;/items&gt;
                          &lt;/ComboBox&gt;
  </code></pre>
  
  <p>But hen an error occurs which says:</p>
  
  <blockquote>
    <p>Uncaught Error: Cannot add direct child without default aggregation
    defined for control sap.ui.core.ListItem</p>
  </blockquote>
  
  <p>How can I define an item aggregation for a ListItem? Would that work?</p>
  
  <p>Thanks a lot, ho</p>