on 04-26-2017 3:37 PM
Hi all,
I try to use sap.u.table.TreeTable to show a hierarchy provided by an Odata service. I bind the data to the treetable in my controller like this:
oTreeTable.bindRows({
path : "/HierarchyElementSet",
filters : oFilters,
parameters : { navigation : {'HierarchyElementSet' : 'ChildNodes'}}
});
I define the treetable in a xml view like this:
<t:TreeTable id="parameter1TreeTable" selectionMode="Single" enableColumnReordering="true" expandFirstLevel="true" title="test">
<t:columns>
<t:Column label="{i18n>ElemID}">
<t:template><Text text="{ElemId}" /></t:template>
</t:Column>
<t:Column id="ElemTextId" label="{i18n>ElemText}">
<t:template><Text text="{ElemText}" /></t:template>
</t:Column>
</t:columns>
</t:TreeTable>
With this configuration my treetable looks like this:
My problem is that also the leafs (SP and SW) have a plus sign indicating to be expandable - although there are no children below them:
Thanks in advance for your help.
Best regards
Dan
UI5 version? its working for me for 1.28 and 1.38 UI5 versions.
I believe this is not a bug nor your code issue, its all about data structure, just verify your data once again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use 1.38. The URL http://[host]:[port]/sap/public/bc/ui5_ui5/ shows 1.30 to 1.38.
I think the problem is the oData service, which is set up using navigation properties (like mentioned here), instead of using annotations (like here). Now I will try to set the treeAnnotationProperties (like mentioned here). Perhaps this will work.
Now I changed from navigation property to treeAnnotationProperties:
oTreeTable.bindRows({
path : "/HierarchyElementSet",
filters : oFilters,
parameters : {
/*navigation : {
HierarchyElementSet' : 'ChildNodes'
},*/
treeAnnotationProperties : {
hierarchyLevelFor : 'HierLevel',
hierarchyNodeFor : 'SeqNr',
hierarchyParentNodeFor : 'ParentId',
hierarchyDrillStateFor : 'DrillDownState'
}
}
});
But this breaks my Get request. Is the syntax correct or do I have to check my Odata service?
Best regards
Dan
With treeAnnotationProperties set in the frontend, I had to add 'HierLevel' and 'ParentId' to the filter in the backend service.
After this I do not get an error any more. But the treeTable is empty now in the frontend, although the backend call gets one record:
<content type="application/xml">
<m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
...
<d:ParentId/>
<d:HierLevel>1</d:HierLevel>
<d:SeqNr>0</d:SeqNr>
<d:DrilldownState>expanded</d:DrilldownState>
...
</m:properties>
</content><br>
Strange. Do you know what I am doing wrong?
Do I have to remove the navigation property from my backend service, when using the treeAnnotations property?
Perhaps this causes the "no-data" problem?
As you can see in my controller I commented it out:
oTreeTable.bindRows({
path : "/HierarchyElementSet",
events : {
dataRequested: function (oEvent) { oTreeTable.setBusy(true); },
dataReceived: function (oEvent) { oTreeTable.setBusy(false); }
},
filters : oFilters,
parameters : {
/*
navigation : {
'HierarchyElementSet' : 'ChildNodes'
}
*/
countMode: 'Inline',
treeAnnotationProperties : {
hierarchyLevelFor : 'HierLevel',
hierarchyNodeFor : 'SeqNr',
hierarchyParentNodeFor : 'ParentId',
hierarchyDrillStateFor : 'DrillDownState'
}
}
});
But in my service implementation in the backend there is still a navigation property (although I am not using it):
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.