Skip to Content

Expand SAPUI5 TreeTable after saving

Hi everyone,

with an editable sap.ui.table.TreeTable when user saves changes, data are refreshed using a GET request to backend and table is re-rendered. Unfortunately, expanded nodes of table are not saved and user has to expand manually again.

Exemple:

We use "Apply to selection" button to save changes made on this tree table. We can see that first and second row are expanded before we click save button.

When save is done, table is refreshed and is not expanded anymore.

I know I can expand to a predetermined level by default, but what I want is to keep the same expanded state that user has before save.

We already tried to save expanded nodes ids and expand these nodes in "onAfterRendering" event of the tree table, but this event is fired too early: table is not completely generated and treeTable.expand() method doesn't work.

Any help would be appreciated :-)

Regards

save-tree-1.jpg (40.9 kB)
save-tree-2.jpg (29.8 kB)
Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Feb 26 at 09:26 AM

    Hi,

    I have the same problem as you described.

    I think about adding a property in the entity which contains information on whether the node is expanded or not and forward it to the database at the backend when I save the entity so that I can read it out in the refreshing process. But I think it seems to be a bit complicated to have an extra field in my database for saving this information but at the moment I have no better idea.

    How did you solve the problem? Did you find a good solution?

    Best regards!

    Add comment
    10|10000 characters needed characters exceeded