I think I have found a solution, with a link to create a glider on the edit form of table1, and reversing the n:1 on the pilot (table1) to a 1:n on the glider.
$crud->set_relation('user_id','users','username',array('status' => 'active'),'priority ASC');
and on the table1, i will display the list of the gliders by adapting this code :
function list_invoices()
{
$crud = new grocery_CRUD();
$crud->set_table('invoices');
$crud->set_subject('invoices');
// add a new column "positions"
$crud->columns('invoices_id','company_name','positions');
$crud->callback_column('positions', array($this, 'positions'));
$output = $crud->render();
$this->load->view('header',$output);
}
function positions($value, $row)
{
$html = '<ul>';
$positions = $this->db->get_where('positions',array('invoices_id'=>$row->invoices_id))->result_array();
if($positions)
{
foreach ($positions as $items)
{
$html.='<li>'.$items['title'].'</li>';
}
}
$html.='</ul>';
return $html;
}
but I have still a problem on the add/edit of pilots. How to display the gliders of the pilot ?