Nodes are being display 1, 2, 11, 12, 3, 4, 5, 6, 7, 8, 9, 10
The node names are stored as strings but are always integers. However, the stored name is one less than the displayed name (and indeed any new name entered on the tidy page). This is the reason for the bizarre sort order - string sort on an integer combined with an off-by-one issue.
Unfortunately, as maths is being done on the names, adding a leading zero isn't going to work. The order of creation is also not preserved in the DB when a new version of the question is created as the new node records are saved in the mangled order.
Simplest solution is to sort nodes when they're requested.
Nodes are being display 1, 2, 11, 12, 3, 4, 5, 6, 7, 8, 9, 10
The node names are stored as strings but are always integers. However, the stored name is one less than the displayed name (and indeed any new name entered on the tidy page). This is the reason for the bizarre sort order - string sort on an integer combined with an off-by-one issue.
Unfortunately, as maths is being done on the names, adding a leading zero isn't going to work. The order of creation is also not preserved in the DB when a new version of the question is created as the new node records are saved in the mangled order.
Simplest solution is to sort nodes when they're requested.