In a BPMN like example, I’m having one Pool and Lanes (steps) each having nodes of all kind types (activity, gateways). Whenever I save the diagram I need to convert the JSON into a custom model/json where order (index) of each one is very important (there’s a system which executes those based on their order). Unfortunately I can’t see in GoJs how easily to extract/convert the model to our custom json with nodes order/index. Even “pool.memberParts” doesn’t return the visual order. Seems like I have to sort by Location.y to get their order.
Are you sure you want to get the nodes ordered only by Y location? What if the nodes are moved by the user up or down? Doesn’t your app actually care more about the links – dependencies – between the nodes?
Only Lanes are filtered by Y location as that’s the only variable that decides the order (user my DnD and re-order them). But the Nodes in Lanes of course are sorted/ordered by “node.findNodesOutOf” and some checks.
Yep, I just built the final JSON already. Was a little surprised and disappointed that there’s no easy and built in way in GoJs to export the model JSON with the correct order in arrays.
Thanks for feedback (keeping best practices is very important).