cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable collapse of nodes in SAP UI5 tree table

Viswanath
Participant
0 Kudos

Hi Everyone,

When I open tree table, I am expanding tree to all nodes by default. I don't want user to collapse nodes.

Could anyone please suggest how to disable collapsing nodes option in sap.ui.table.treeTable control.

Thanks,

Best Regards,

Viswanath

Accepted Solutions (1)

Accepted Solutions (1)

Viswanath
Participant
0 Kudos

Hi,

I found other option to disable by overriding CSS class of tree icon(Arrow icon to expand or collapse)

.sapUiSizeCompact .sapUiTableTreeIcon, .sapUiSizeCozy .sapUiTableTreeIcon {
       pointer-events: none; !important;
   
} 

Thanks,

Best Regards,

Viswanath

Answers (1)

Answers (1)

pierre_dominique2
Contributor
0 Kudos

Hi,

Well I guess you could extend the control or the TableRenderer but you should probably not do it. Here's where the tree icon is added in TableRenderer.js

TableRenderer.renderTableCellControl = function(rm, oTable, oCell, bIsFirstColumn) {
	if (TableUtils.Grouping.isTreeMode(oTable) && bIsFirstColumn) {
		var oRow = oCell.getParent();
		rm.write("<span class='sapUiTableTreeIcon' tabindex='-1' id='" + oRow.getId() + "-treeicon'");
		oTable._getAccRenderExtension().writeAriaAttributesFor(rm, oTable, "TREEICON", {row: oRow});
		rm.write("> </span>");
	}
	rm.renderControl(oCell);
};

Expand all node by default and let the user decide if he/she wants to expand or collapse nodes.

Cheers,

Pierre

Viswanath
Participant
0 Kudos

Hi,

Thanks for your response.

the reason why I want to disable collapse button is ,when I collapse the nodes and Expand it again selection is gone.

Could you please help how can I resolve this issue.

Thanks,

Viswanath