Jump to content


Priority Field Relation in the set_relation_n_n function

set_relation_n_n

  • Please log in to reply
3 replies to this topic

#1 Cèsar Martí

Cèsar Martí

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts

Posted 14 March 2012 - 12:50 PM

Hi guys!

I need to do something like the 'Actors' example from here http://www.grocerycr..._a_relation_n_n. Of course, I've been reading the forum posts of the set_relation_n_n fucntion and the documentation from here http://www.grocerycr...et_relation_n_n

My doubt is about the Priority Field Relation in the Ralation Table. What is it suposed to be in that field? I see it've to be an INT(11) in the database table. But, what should be the data in that field? In the 'Actors' example, why isn't be enough with the relation between films and actors? Why not just 'film_id' and 'actor_id'? Why this 'priority' field?

Any kind of help will be appreciate. Thanks a milion.

#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,150 posts
  • LocationLondon

Posted 14 March 2012 - 06:49 PM

The priority field is not a required filed. So if you want also to sort your multiple select you can do it by just adding the last segment (priority field). For example you can simply have:
$crud->set_relation_n_n('actors', 'film_actor', 'actor', 'film_id', 'actor_id', 'fullname');
without any problem.

The priority is if you want to have a drag-n-drop to change the priority like the image: drag-and-drop.png
Posted Image

#3 Cèsar Martí

Cèsar Martí

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts

Posted 15 March 2012 - 08:32 AM

I see. I'm gonna test it right now. Thanks Johnny.

#4 Hoergold2

Hoergold2

    Newbie

  • Members
  • Pip
  • 3 posts
  • LocationBerlin

Posted 19 September 2012 - 03:13 PM

Interesting: I asked myself the same question (what is this field for). As I understood it it comes from a special use case and does add some nice funtionality (drag'n'drop to reorder the persons). But allow me the suggestion that it could be explained also in the API - maybe one time very clear for all..

Thanks,
Martin





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users