[quote name='djbeemer' timestamp='1342183403' post='2691']
This works well. I have found a problem with it:
If I have 2 grids, and both have relations set, the relations from the first grid get applied to the second grid. and the query then crashes.
eg:
$details = new Grocery_crud_multi();
$details->grid_add(1);
$details->grids[1]->set_table('projects_events');
$details->grids[1]->set_subject('Project Event');
$details->grids[1]->set_relation('event_type_id','types_events','event_type_name');
$details->grid_add(2);
$details->grids[2]->set_table('projects_appliances');
$details->grids[2]->set_subject('Project Appliance');
$details->grids[2]->set_relation('room_id','types_rooms','room_name');
$details->grids[2]->set_relation('type_id','types_appliances','appliance_name');
$details->grids[2]->set_relation('make_id','types_makes','make_name');
$output = $details->render();
[b] A Database Error Occurred[/b]
Error Number: 1054
Unknown column 'j5e891baf.event_type_name' in 'field list'
SELECT `projects_appliances`.*, j5e891baf.event_type_name AS s5e891baf, j8273f993.room_name AS s8273f993, j94757cae.appliance_name AS s94757cae, j14dd5396.make_name AS s14dd5396 FROM (`projects_appliances`) LEFT JOIN `types_rooms` as j8273f993 ON `j8273f993`.`room_id` = `projects_appliances`.`room_id` LEFT JOIN `types_appliances` as j94757cae ON `j94757cae`.`type_id` = `projects_appliances`.`type_id` LEFT JOIN `types_makes` as j14dd5396 ON `j14dd5396`.`makes_id` = `projects_appliances`.`make_id` LIMIT 25
Filename: /home/app/public_html/models/grocery_crud_model.php
Ive done some debugging in the model file, and found that the $this->relation array in the get_list function (when rendering the second grid) has the relation from the first grid included.
I was wondering if you could have a look at this??
The same happens when not using the multi plugin if i define the 2 tables manually.. and then render() twice.
[/quote]
[b]is true when relationships are blocked, not how to fix[/b].
[b]when you add or edit out the message in both tables[/b]