on 06-11-2015 11:41 AM
Hi
Pretty new to UI5 coding so excuse me if terminology is not 100%.
I have a model on HANA exposed as an oData service which I can successfully read into my applet. Each row from HANA has both the current ID and the PARENT ID, however from what I have read it is currently impossible to natively consume this directly into the TreeTable construct with the correct parent/child relationships. Is there a way to post-process the oData from HANA to get this into the correct format?
Here is what I have, so far:
var jasonModel = new sap.ui.model.json.JSONModel();
var url = "/odata/PS.xsodata/PPS(P_SAPClient = '100',P_MENID = 'STANDARD')/Results?$select=ID,TLEVEL,ESTCAT,ESTNAM,P_ID,P_TLEVEL,P_ESTCAT,P_ESTNAM&$orderby=ID asc&$format=json";
var oTree = new sap.ui.table.TreeTable({ // create Table UI
columns : [
{label: "ID", template: "ID", sortProperty: "ID" },
{label: "TLEVEL", template: "TLEVEL", sortProperty: "TLEVEL" },
{label: "ESTCAT", template: "ESTCAT", sortProperty: "ESTCAT" },
{label: "ESTNAM", template: "ESTNAM", sortProperty: "ESTNAM" },
{label: "P_ID", template: "P_ID", sortProperty: "P_ID" },
{label: "P_TLEVEL", template: "P_TLEVEL", sortProperty: "P_TLEVEL" },
{label: "P_ESTCAT", template: "P_ESTCAT", sortProperty: "P_ESTCAT" },
{label: "P_ESTNAM", template: "P_ESTNAM", sortProperty: "P_ESTNAM" } ]
});
jasonModel.loadData(url,{},false, "GET");
sap.ui.getCore().setModel(jasonModel);
oTree.setModel(jasonModel);
oTree.bindRows("/d/results", oTree);
oTree.placeAt("treeArea");
So what I need is somehow to loop through the data returned from HANA and put it into the correct parent/child format.
My thanks in advance
Marc
post json structure from server
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are the first few lines from the server (note I just stripped out the type/uri for readability purposes):
{
{
{
{
{
{
}
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.