It looks like you're new here. If you want to get involved, click one of these buttons!
I'd like to order the right hand has_many combo box by the precedence value of the item listed. I'd like to also be able to re-order the right hand box by drag and drop, again relative to the precedence. I realise that setting 'sorting' to TRUE allows ui ordering.
The combo box has a "sorting_xyz" field which has a string array of the order set in the right hand ul list, but that order doesn't seem to be according to the precedence value, if anything it seems relative to the id. Is there a mechanism for making this existing order dependent on the precedence?
You are right in that it is not dependent on the precedence but on the ID value. The items are saved in the order in which they appear and so their IDs naturally determine their order. Using the ID instead of the precedence allows it to work on model's without a precedence column.
The 'sorting' parameter can also be an array of values in the order in which you want them sorted instead of TRUE. By default, it's the value sent to the field.
I managed to get what I wanted without ajax: using on_after_post() I read in the sorting input array string, turned it into an array, and, based on the (key) order of the ids, saved them as precedence values. Much easier than I anticipated, thanks to Fuel!