Physically sorting nodes dropped into a group

Starting with the table layout example from the samples I have a set of groups and I drop from the palette a new node. The new node is manually assigned a sequence number. The preferred behavior is to have the nodes on refresh (or secondarily, when the sequence number is changed) to stack themselves vertically based on the assigned sequence number.

I sort the node data based on the sequence number prior to loading the nodedataarray but that seems to have no bearing on the physical vertical positioning.

Thanks in advance.

That’s right – the order of data in the Model.nodeDataArray does not necessarily have any bearing on the layout or on the locations of the nodes.

In the Table sample, notice how the Group template specifies its Group.layout to be a GridLayout. You’ll want to set the GridLayout.comparer to be a comparison function that takes two Parts. That comparer function can compare the part.data.sequenceNumber of the two Parts, or whatever you like.

Thanks much Walter. I appreciate the quick response.