How to array the fields in a sorting order after the table fields are loaded

Hi
How to arrang the fields in a sorting order after the table fields are loaded

if there is a links. it should auto arrange to that corresponding field

Are all of those “fields” in a Panel.itemArray? Does the Panel.itemTemplate use a GraphObject.portId that is independent of the position in the array?

If so, wIthin a transaction, sort that Array and call Panel.rebuildItemElements(). Panel | GoJS API

I hope that will work. Please tell us if your conditions are different.

Thanks

In itemArrray those are fields,
the fields itself act has a ports.
When i applied you are code the fields are arranged sorted order properly but links were deleted.
the links also should be arrange accordingly to it.

Instead of calling Panel.rebuildItemElements, try sorting a copy of the Array, and then calling Panel.insertAt of the original (and current) Panel.itemArray items in the sorted order.