Tree simple example in sapui5

Tree Example


view.xml


<Page title="Tree Example">

<Tree
    id="Tree"
    items="{/}">
<StandardTreeItem title="{text}" />
</Tree>

</Page>


controller.js

onInit : function (evt) {


var a=this.getView().byId("Tree");
  var b=new sap.ui.model.json.JSONModel("model/Tree.json");
  a.setModel (b);

}



data.json file

 [
{
"text": "Rigved",
"ref": "sap-icon://attachment-audio",
"nodes":
[
{
"text": "Reliance",
"desg": "Company",
"ref": "sap-icon://attachment-e-pub",
"nodes":[
{
"text": "Aasavari",
"ref": "sap-icon://attachment-html"
},
{
"text": "Richa",
"ref": "sap-icon://attachment-html"
},
{
"text": "Rahul",
"ref": "sap-icon://attachment-html"
},
{
"text": "Pratik",
"ref": "sap-icon://attachment-html"
},
{
"text": "Madhu",
"ref": "sap-icon://attachment-html"
},
{
"text": "Sai",
"ref": "sap-icon://attachment-html"
}
]
},



{
"text": "Mahindra",
"desg": "Company",
"ref": "sap-icon://attachment-e-pub",
"nodes":[
{
"text": "Digvijay",
"ref": "sap-icon://attachment-html"
},
{
"text": "Tushar",
"ref": "sap-icon://attachment-html"
}
]
}


]
}

]



result :

Post a Comment

Previous Post Next Post