⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


Member Since 08 Dec 2012
Offline Last Active Jun 12 2013 03:47 AM

#7718 AJAX Listing View? Multiple Listing Views?

Posted jjwdesign on 31 May 2013 - 03:33 PM

Probably on the next version of GC.


That's great to hear. I'll be sending in my donation soon!

#7069 set_relation() - Edit from both sides of relationship?

Posted jjwdesign on 27 April 2013 - 02:54 AM

Again, thank you for continuing to support this project through this forum!


I think I'm overlooking something simple. I'm trying to allow someone to edit from both sides of a 1-n relationship (set_relation). For example, the Grocery Crud demo of Employees has a relationship to the Office City. You can easily view a list of all employees, edit an employee and change the Office City from a drop down.


Demo: Employees - Office City





But, if you created a list view of Office Cities (or Offices), edit a Office City... there's no way to edit the related Employees to that Office City. What's the best way to create this multi-select drop down (chosen plugin) field? I assume I would need to write my one model after save callback to save the relationship data properly.


n-n relationship?


I noticed that the n-n relationship allows you to edit from both sides of the relationship; as expected. Should I setup a related table and just use a n-n relationship instead? It's not really a n-n, as an Employee can only belong to one Office City (at least in my issue). Not using the proper relationship bothers me a bit. How can I then prevent an Employee from being added to Multiple Cities? Custom add/edit Validation rules?


Am I missing something?

Thanks, Jeff