Skip to Content
0
Jul 02, 2020 at 09:22 AM

TreeTable empty

159 Views

Hello Comunity,

I have the following problem with control "sap/ui/table/TreeTable"

I have a Json file like this:

id

icon

nodes[]

[
 {
 "id": "1300004444 ",
 "icon": "sap-icon://competitor",
 "nodes": [
 {
 "id": "1300004444 ",
 "icon": "sap-icon://competitor"
 },
 {
 "id": "1300004444 001000",
 "icon": "sap-icon://competitor"
 },
 {
 "id": "1300004444 001001",
 "icon": "sap-icon://competitor"
 },
 {
 "id": "1300004444 001002",
 "icon": "sap-icon://competitor"
 },
 {
 "id": "1300004444 001003",
 "icon": "sap-icon://competitor"
 }
 ]
 },
 {
 "id": "1300004441 ",
 "icon": "sap-icon://competitor",
 "nodes": [
 {
 "id": "1300004441 ",
 "icon": "sap-icon://competitor"
 },
 {
 "id": "1300004441 001000",
 "icon": "sap-icon://competitor"
 },
 {
 "id": "1300004441 001001",
 "icon": "sap-icon://competitor"
 }
 ]
 }
]

I have bind the file in the init of view controller.

let oModel = new JSONModel("/webapp/data/SRV1.json");
var oColumns = [
new sap.ui.table.Column({
name: "column1",
label: new sap.m.Label({
text: "column1"
}),
template: new sap.m.Text({
text: "{id}"
})
}),
new sap.ui.table.Column({
name: "column2",
label: new sap.m.Label({
text: "column2"
}),
template: new sap.m.Text({
text: "{icon}"
})
})
];
var oTreeTable = new TreeTable("TreeTable", {
columns: oColumns
}); oTreeTable.setModel(oModel, "NewTree");
oTreeTable.bindRows({
path: "NewTree>/",
parameters: {
arrayNames: ["nodes"]
}
});
oTreeTable.placeAt("content");

When displaying in the Web browser I see this:

Do you have an idea why I cannot see the data?

Thanks in advance

Attachments

treenode.png (5.5 kB)