Skip to Content
0

Please help me with this sap.m.Tree behaviour

Feb 06, 2017 at 06:49 AM

262

avatar image

Hi all,

I am playing around with the sap.m.Tree component and encountered some odd behavior which I can't solve.

What I'm try todo - To create a master/detail application. The master view must contain a sap.m.Tree component showing a tree structure. Clicking on a node expand until a leaf node is reached.

Where I am - The application was generated using WebIDE template and I added following sap.m.Tree code:

<Tree 
id="Tree"
items="{path: '/NodeSet'}"
enableBusyIndicator="false">
<StandardTreeItem title="{Name}"></StandardTreeItem>
</Tree>

I created the OData service and it seems to work as expected. The UI5 applications loads. And the root nodes display as expected.

The problem - After initial load, I click on a node in the Tree. Now I get an error.

Request

GET NodeSet?$filter=ParentId%20eq%20%271%27&$skip=0&$top=1.7976931348623157e+308 HTTP/1.1

Response

{"error":{"code":"005056A509B11EE1B9A8FEC11C22F78E","message":{"lang":"en","value":"Invalid system query options value"},"innererror":{"transactionid":"EFB0F074EC2E11E6CB2A00001130A83A","timestamp":"20170206061556.1369800","Error_Resolution":{"SAP_Transaction":"Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details","SAP_Note":"See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"}}}}

From looking at the network request it is clear what is causing the issue. The request parameter $top is not an int but some very big decimal. If changed to $top=1 the request works as expected.

What am I doing wrong and what do I change to get this working correct?

BUT - curiously if I close the error message and select another Node (..the initial one I clicked is still not expanded..) I again get an error message but this time both the Nodes expand??! This second click generated 2 requests. See request-1.txt request-2.txt.

Thank you for helping!

Nic

ui5-tree-err1.png (16.0 kB)
ui5-tree-err2.png (18.0 kB)
ui5-tree-err3.png (18.7 kB)
request-1.txt (3.9 kB)
request-2.txt (2.1 kB)
ui5
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Nic Botha
Feb 06, 2017 at 10:44 PM
1

I might have found the problem but not sure if it is my usage of the component or a bug??! I extended the sap.m.Tree component and overrode the update function and replaced this line:

aContexts = oBinding.getContexts(0, Number.MAX_SAFE_INTEGER);

with this line:

aContexts = oBinding.getContexts(0, 100);

Now the Tree renders as expected and expands as expended without any errors. Happy me!

It could be only an issue if dynamically loading the Tree as opposed to providing a complete model.

Hope it helps and if you find out more leave a comment.

Nic


                            
Share
10 |10000 characters needed characters left characters exceeded