on 2021 Sep 16 6:14 AM
Hello Experts,
I am working on a custom Fiori application. When I am adding rows at the run time in Tree Table, want to keep the same nodes open. But the default behavior of a TreeTable is when something happens with it (either Add a new node/ Delete an existing one), it gets rendered again and all nodes are collapsed.
Default behaviour after adding a row in any node:
Expected behavior:
I have tried couple of variations wherein I used expand to certain level, but it expands all the nodes at same level
onHierDataRecieved: function (oData) {
var me = this;
var level = this.getModel("viewModel").getProperty("/expandToLevel");
if (level !== "") {
if (oData.getParameter("data")) {
if (oData.getParameter("data").results.length > 0) {
if (oData.getParameter("data").results[0].Parentid === "00000000") {
var parentLevel = parseInt(formatter.getParentLevel(level));
this.expandToLevel(parentLevel);
}
}
}
}
}
Another try:
I tried to fire the event, toggleOpenState after the success create call but it also seems not to be working fine
this.byId("treeTable").fireToggleOpenState({ rowIndex: me.rowIndex, rowContext: me.rowContext, expanded: true });
If anybody has come across such an issue, kindly revert or suggest if there is any way out to make it possible.
Thanks and Regards,
Navneet K.
Hi,
in our case (SAPUI5 v1.84, OData V2), we used the treeState property of the ODataTreeBinding (API Reference - Demo Kit - SAPUI5 SDK (ondemand.com)) and the function getCurrentTreeState:
var oTreeState = oTreeTable.getBinding("rows").getCurrentTreeState();
oTreeTable.getBinding("rows").setTreeState(oTreeState);
But, according to the documentation, there is limitation:
A tree state handle can be given to the ODataTreeBinding when two conditions are met: The binding is running in OperationMode.Client AND the sap.ui.table.TreeTable is used. The feature is only available when using the ODataTreeBindingAdapter, which is automatically applied when using the sap.ui.table.TreeTable. The tree state handle will contain all necessary information to expand the tree to the given state.
This feature is not supported in OperationMode.Server and OperationMode.Auto. Please see also the getCurrentTreeState method in class ODataTreeBindingAdapter.
I hope it will help.
Regards
Fabrice
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.