I need to be able to set order of items in a ComplexTableField - this order has to be preserved and items should be listed in the same order on the page.
Currently I see one solution that I am unfortunately unable to implement :)
I would add a "Position" field to my DataObjects and this field would be edited in the ComplexTableField. I would like to add "Up" and "Down" links (or any similar solution that doesn't require the user to type position integers into field) to each item to change position. This may be implemented with setFieldFormatting that would generate appropriate links.
The the "appropriate" word is the tricky part.
I don't know how to:
1. create operation that would change the position value of item and its neighbour (should be easy),
2. call this operation when the link is clicked,
3. reload the table view (maybe this would be automatic).
The tutorial [1] has a link as an example: <a href=\"admin/security/index/1?executeForm=EditForm&ID=1&ajax=1&action_callfieldmethod&fieldName=Members&ctf[childID]=$ID&ctf[ID]=1&ctf[start]=0&methodName=edit\">
What I need most is a general overview of how to achieve this and where to look for details.
[1] http://doc.silverstripe.com/doku.php?id=tablelistfield#sorting