How to order nodes using standard controls or expressions

This article outlines options available for ordering nodes, including supplied controls and programmatic method.  There is detail supplied of standard rules for ordering supplied in place, with a more detailed worked example at the end

Ordering: Standard Rules

  • The default structure of a given displayed hierarchy is built based on the pasted data depth first, top to bottom (lowest depth [1] to highest depth)
  • All standard Tree Views display nodes at a given level adjacent to other nodes at the same level e.g. all level 2s on the same horizontal
  • The default ordering of sibling nodes, before any subsets are applied, will be by ID ascending
  • Ordering set in Trunk datasets is retained on save.
  • The order of sibling nodes cannot be saved in a branch; only reparenting (before/after) can be saved in branch views. (Whilst you are able to manipulate sibling order in a branch, when you try to save the branch, the sibling order reverts to that in the trunk.)

Ordering: UI Controls

There are supplied interactive visual controls, available within tree views, to determine order:

  • multiple controls are available by clicking on the node, including before, after, promote, demote
  • dragging and dropping in tree view triggers  an alternate dialogue for managing ordering




Ordering: Advanced Sort Using Expressions

There is general coverage of expression-based sort here, however if working with a Tree View an expression will have typically three elements e.g. in expression

1 select all nodes
2 select sort property
3 set the _sortOrder property of the nodes, which is only used for sibling ordering [visually]

When running an expression to set sort order visually, ensure before you proceed that

the dataset is free from any filtering or similar (pagination) before applying the sort function documented here, as it needs to run on the whole dataset.

Ordering with Expressions: Worked Example


In this simplified example, the required output is that siblings should be ordered by full name, in reverse order: the correct expression to apply should be:

nodes().sort("full name", "desc").setSortOrder()

First, ensure the sort order works as desired using Expressions Manager and check the sort order is correct for the sort-property using

nodes().sort("full name", "desc")


Once verified, 'fix' the sort order by adding .setSortOrder() to Expression Manager, ensure expression is run in Macro mode

nodes().sort("full name", "desc").setSortOrder()



No change will be visible at this point - click refresh button (circular arrow)


Save to retain settings ... and at this point you can run additional subsetting operations e.g. filter, paginate with the required ordering embedded.

Have more questions? Submit a request