sap.ui.jsview("treetable.treetable", {
getControllerName : function() {
return "treetable.treetable";
},
createContent : function(oController) {
oTableData={
root:{ branch:"br",details:"br details",
0:{ branch:"mech",details:"mechanical engg",
0:{subject:"Dynamics",grade:"3"},
1:{subject: "hydraulics",grade:"4"}
},
1: { branch:"elec",details:"electrical engg",
0:{subject:"circuit theory",grade:"4"},
1:{subject: "elec motors",grade:"4"}
},
2: { branch:"ece",details:"electrical engg",
0:{subject:"analog electronics",grade:"4"},
1:{subject: "digital electronics",grade:"3"}
},
3: { branch:"cse",details:" coputer sc engg",
0:{subject:"c programming",grade:"3"},
1:{subject: " c++ programming",grade:"4"}
}
}
};
oTable = new sap.ui.table.TreeTable({
columns: [
new sap.ui.table.Column({label: "Branch", template: "branch"}),
new sap.ui.table.Column({label: "Subject", template: "subject"}),
new sap.ui.table.Column({label: "Details", template: "details"}),
new sap.ui.table.Column({label: "Grade", template: "grade"})
],
});
oModel= new sap.ui.model.json.JSONModel();
oModel.setData(oTableData);
oTable.setModel(oModel);
oTable.bindRows("/root");
return new sap.m.Page({
title: "Title",
content: [
oTable
]
});
}
});
output:
getControllerName : function() {
return "treetable.treetable";
},
createContent : function(oController) {
oTableData={
root:{ branch:"br",details:"br details",
0:{ branch:"mech",details:"mechanical engg",
0:{subject:"Dynamics",grade:"3"},
1:{subject: "hydraulics",grade:"4"}
},
1: { branch:"elec",details:"electrical engg",
0:{subject:"circuit theory",grade:"4"},
1:{subject: "elec motors",grade:"4"}
},
2: { branch:"ece",details:"electrical engg",
0:{subject:"analog electronics",grade:"4"},
1:{subject: "digital electronics",grade:"3"}
},
3: { branch:"cse",details:" coputer sc engg",
0:{subject:"c programming",grade:"3"},
1:{subject: " c++ programming",grade:"4"}
}
}
};
oTable = new sap.ui.table.TreeTable({
columns: [
new sap.ui.table.Column({label: "Branch", template: "branch"}),
new sap.ui.table.Column({label: "Subject", template: "subject"}),
new sap.ui.table.Column({label: "Details", template: "details"}),
new sap.ui.table.Column({label: "Grade", template: "grade"})
],
});
oModel= new sap.ui.model.json.JSONModel();
oModel.setData(oTableData);
oTable.setModel(oModel);
oTable.bindRows("/root");
return new sap.m.Page({
title: "Title",
content: [
oTable
]
});
}
});
output:
No comments:
Post a Comment