Skip to Content
avatar image
Former Member

How to disable collapse of nodes in SAP UI5 tree table

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 24, 2017 at 09:17 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 14, 2017 at 03:18 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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