⚠ In case you've missed it, we have migrated 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 is an archived forum. ⚠

  •     

profile picture

Take values from other table



basque

basque
  • profile picture
  • Member

Posted 28 March 2014 - 15:36 PM

First of all hi too everybody :)
 
Well i'm new with codeigniter and Grocery CRUD and i have a question about changing the edit form. 
 
I have this database: 
 
Person
idPerson (PK)
Name
idPlace  (FK)
 
Place
idPlance (PK)
place_name
idSchool  (FK)
idfloor  (FK)
 
floor_school
idSchool (PK) (FK)
idfloor (PK)  (FK)
order
image
 
floor
idfloor  (PK)
floor name
 
school
idschool  (PK)
idName
 
Explanation of DB: A person can have one place. A Place must be from some school and some school floor (this relation about floor and school is in the table floor_school)
 
Well the thing is that i want to show the list of all persons and allow the user to assign them a place or not. 
 
To reach that i make 
 
$crud = new grocery_CRUD();
$crud->set_table('person');
$crud->set_relation('idplace', 'place', '{place_name} - {idSchool}');
 
The thing is that it will be ideal to show the place name and instead of showing the school id show the actual school name from the table school. 
 
I now that this is a join from person -> place -> floor_school -> school but i think its not possible to relate those tables.
 
Someone can give me a hint to do this? 
 
Other option will be to call a different view when you click the add and edit button, is that possible? I mean when i click those buttons show the user a form created by me. I don't know if with jquery i could make the trick...