Hello,
I'm trying to get data into a simple table.
I've used the following tutorial to get the basic layout for the table and the layout:
As you can see it uses an oData connection.
But I want to get the following data into the same table.
I have the following XML:
or JSON Data:
{"RESULTS":[
{"RESULT":{"TGROUP":"0001","TGROUP_TXT":"Hogeschool/Universitair"}},
{"RESULT":{"TGROUP":"0002","TGROUP_TXT":"Stagiairs"}},
{"RESULT":{"TGROUP":"0003","TGROUP_TXT":"Starters/pas afgestudeerden"}},
{"RESULT":{"TGROUP":"0004","TGROUP_TXT":"Leidinggevenden/directie"}},
{"RESULT":{"TGROUP":"0005","TGROUP_TXT":"Specialisten"}},
{"RESULT":{"TGROUP":"0006","TGROUP_TXT":"ICT"}},
{"RESULT":{"TGROUP":"0007","TGROUP_TXT":"Technici"}},
{"RESULT":{"TGROUP":"0008","TGROUP_TXT":"Arbeiders"}},
{"RESULT":{"TGROUP":"0009","TGROUP_TXT":"Zorg"}},
{"RESULT":{"TGROUP":"0010","TGROUP_TXT":"Maatschappelijk werk"}},
{"RESULT":{"TGROUP":"0011","TGROUP_TXT":"Hoger onderwijs"}},
{"RESULT":{"TGROUP":"0012","TGROUP_TXT":"Kleuter/lager onderwijs"}},
{"RESULT":{"TGROUP":"0013","TGROUP_TXT":"Shared Service"}}]}
I have found the following test code:
var oTable = sap.ui.getCore().byId("table");
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({
firstName: "Peter",
lastName: "Pan"
});
oModel.loadData("data.json");
oTable.setModel(oModel);
rPannel.addContent(oTable);
layout.createRow(rPannel);
this.addContent(layout);
But I don't know if this is correct, nor don't I know how to build the table. Or how to structure the data if it's coming from the online xml or json.
Kind regards,
Vincent