title: How to build an expandable sap.m.Table in sapui5?
body: <p>I am searching for a kind of TreeTable that uses <code>sap.m.Table</code> as base.
  My first "hack" looks like this:</p>
  
  <p>Experimental data model:</p>
  
  <pre><code>var oModel = new sap.ui.model.json.JSONModel({
      "Items" : [
                 {"Name" : "A", "SubItems" : [
                                              {"Name" : "A.1" },
                                              {"Name" : "A.2" },
                                              {"Name" : "A.3" },
                                             ]
                 },
                 {"Name" : "B", "SubItems" : [
                                              {"Name" : "B.1" }
                                             ]
                 },
                 ]
  });
  this.getView().setModel(oModel, "expand");
  </code></pre>
  
  <p>Experimental Table implementation:</p>
  
  <pre><code>var oContent = new sap.m.Table({      
                items : {
                  path : "expand&gt;/Items",
                  template : new sap.m.ColumnListItem({
                    customData : [ new sap.ui.core.CustomData({
                              key : "SubItems",
                              value : "SubItems",
                              customData : {
                                path : "expand&gt;SubItems",
                                template : new sap.ui.core.CustomData({
                                  key : this.createId("subItem"),
                                  value : new sap.m.ColumnListItem({
                                    cells : [
                                             new sap.m.Text({
                                               text: "{expand&gt;Name}",
                                             })
                                             ]
                                  })
                                })
                              }
                            })                          
                          ],
                    type : sap.m.ListType.Active,
                    cells: [
                              new sap.m.Text({ text: "{expand&gt;Name}" }),
                            ],
                    press : [function(oEvent) {
                      var oRow = oEvent.getSource();
                      var oTable = oRow.getParent();
                      var oItems = oTable.getItems();
  
                      var insertIndex = -1;
                      var oSubItemsData = undefined;
  
                      for (var i=0;i&lt;oItems.length;i++) {
                        if (oItems[i]==oRow) {
                          oSubItemsData = oRow.getAggregation("customData").filter(function(oData) {return oData.getProperty("key") == "SubItems";});
                          insertIndex = i;
                        }
                      }
  
                      var oSubItems = oSubItemsData[0].getAggregation("customData").map(function(oData) {return oData.getValue();});
                      for (var j=0;j&lt;oSubItems.length;j++) {
                        var mShownSubItems = oItems.filter(function(oShownItem) {
                          return oShownItem == oSubItems[j];
                        });
                        if (mShownSubItems.length&gt;0) {
                          console.log("removing"+j);
                          oTable = oTable.removeItem(oSubItems[j]);
                        } else {
                          console.log("adding "+(insertIndex+j+1));
                          oTable = oTable.insertItem(oSubItems[j],insertIndex+j+1);
                        }                          
                      }                        
                    }, oController]
                  })
                },
                columns : [ new sap.m.Column({}) ],
      });
  </code></pre>
  
  <p>I figured out different problems with this "hack".
  First of all the binding of the SubItems is not displayed, if I use hard coded text the text is shown.
  Second problem is, that I can only insert exactly one row.</p>
  
  <p>How can this be solved?</p>