This is simple, let's say that we have this example:
http://www.grocerycr..._a_relation_n_n . So in our case the ordering that we actually want is per fullname (default) . If we wanted for example to order it by last_update with the help of your contribution we will do this:
$crud->set_relation_n_n('actors', 'film_actor', 'actor', 'film_id', 'actor_id', 'fullname','priority',null,'last_update');
but if don't want to actually order it by priority we can simply do this:
$crud->set_relation_n_n('actors', 'film_actor', 'actor', 'film_id', 'actor_id', 'fullname',null,null,'last_update');
and NOT this:
$crud->set_relation_n_n('actors', 'film_actor', 'actor', 'film_id', 'actor_id', 'fullname','actor_id',null,'last_update');
The above code is wrong, as the "priority" field is the field that you add only if you want to reorder the values and there is a specific field for this.
For example if we use the priority field like this:
$crud->set_relation_n_n('actors', 'film_actor', 'actor', 'film_id', 'actor_id', 'fullname','priority',null,'last_update');
we will have this:
[attachment=287:2012-09-18_003209.png]
but if we add as null the priority field the user will not be able to change the ordering and also the interface is also changed to not confuse the users. So in our case if you have this:
$crud->set_relation_n_n('actors', 'film_actor', 'actor', 'film_id', 'actor_id', 'fullname',null,null,'last_update');
you will have something similar to this as a result:
[attachment=288:2012-09-18_003309.png]
Cheers
Johnny