0
votes

I wanted to bind below JSON data to SAP UI5 List view. The view is in XML format. Same data is being used to create Tree view. Please suggest me if there is any working example to get this done.

[{
  "text": "Node1",
  "ref": "sap-icon://attachment-audio",
  "nodes": [{
    "text": "Node1-1",
    "ref": "sap-icon://attachment-e-pub",
    "nodes": [{
        "text": "Node1-1-1",
        "ref": "sap-icon://attachment-html"
      },
      {
        "text": "Node1-1-2",
        "ref": "sap-icon://attachment-photo",
        "nodes": [{
          "text": "Node1-1-1",
          "ref": "sap-icon://attachment-text-file",
          "nodes": [{
              "text": "Node1-1-1-1",
              "ref": "sap-icon://attachment-video"
            },
            {
              "text": "Node1-1-1-2",
              "ref": "sap-icon://attachment-zip-file"
            },
            {
              "text": "Node1-1-1-3",
              "ref": "sap-icon://course-program"
            }
          ]
        }]
      }
    ]
  }]
}]
1

1 Answers

0
votes

Did you check the sample on sapui5 on demand?

It has a treeView example with a jsonModelBinding

TreeModel with jsonBinding

https://sapui5.hana.ondemand.com/#/sample/sap.m.sample.TreeExpandMulti/preview

Using the list view as it its it's not possible. You would have to extend it witch IMHO would achieve a result quite similar of the tree view component.