Jump to content


display 2 tables (parent and related children table)

crud multiple relation display

  • Please log in to reply
No replies to this topic

#1 fredconv

fredconv

    Member

  • Members
  • PipPip
  • 17 posts

Posted 05 September 2012 - 01:54 PM

Hi

I m quite new to grocery CRUD. this is helping decrease time production a lot :)
but i get stuck.

i have 2 tables:
tbl_parent (id, name)
tbl_children(id,parent_id,name)

in my first page i display list of all parents with a link on the id to see the detail of the clicked parent.
on second page i wanna see the parent i clicked on and below another part with all children related to the parent i ve clicked.

But i can t get the second
  public function detail_item($id)
    {
	    $crud_parent = new grocery_CRUD();
	    $crud_parent->set_table('test_parent');
	    $crud_parent->where('id',$id);
	    $output_parent =  $crud_parent->render();
	   
	    $crud_children = new grocery_CRUD();
	    $crud_children->set_table('test_enfant');
	    $crud_children->where('parent_id',$id);
	    $output_children =  $crud_children->render();
	   
		 $this->result_output($output_parent,$output_children);
			
    }

and my result output is like this:
	 function result_output($data1 = null,$data2 = null )

    {
	    $this->load->view('templates/header', $data1,$data2);
	    $this->load->view('templates/navigation',  $data1,$data2);
	    $this->load->view('templates/content_template.php', $data1,$data2); 
	    $this->load->view('templates/footer', $data1,$data2);
	   
    }
and the content_template is as simple as:
<div class="content content_output1">
    <h1>ITEM DETAILS</h1>
	    <?php echo $data1; ?>
</div>
<div class="content content_output2">
    <h2>CHILDREN LIST</h2>
	    <?php echo $data2; ?>
</div>
   

But data1 and 2 seems to no get passed to view...

I saw there is a
new Grocery_crud_multi()
but with this i don t see the way to add my html code between the 2 grid .

Can t you point me to the right direction please ?

Thanks





Also tagged with one or more of these keywords: crud, multiple, relation, display

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users