⚠ 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

master-child LAYOUT



jcarlier

jcarlier
  • profile picture
  • Member

Posted 30 October 2015 - 10:44 AM

hi,

 

 

i would like to make a master-child layout   but i have some problems
 
i have a table : Factures
 
CREATE TABLE IF NOT EXISTS `factures` (
  `id_facture`                        int(11) unsigned NOT NULL AUTO_INCREMENT,
  `facture_nom`                       varchar(50)  NOT NULL DEFAULT '',
  `facture_numero`                    varchar(30)  NOT NULL DEFAULT '',
...............

 

 
and a table  : Articles
 
CREATE TABLE IF NOT EXISTS `articles` (
  `id_article`                        int(11) unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique identifier',
  `id_facture`                        int(11) unsigned NOT NULL, 
......................................................................

 

 
there are many Articles in one facture ( 1-n)
 
so when i click on a button on a row (facture)   , i would like to have the  list of articles
 
----------------------------------------------------------------------------------------------------------------------------------
i have tried  (in facture function):
 
$crud->add_action('Articles', '', '','fa fa-list-alt',array($this,'list_articles'));
..
..
..
 
public function list_articles($primary_key )
 
{
   $crud1= new Grocery_CRUD();
   $crud1->set_table('articles');
   $crud1->where(`id_facture`,$primary_key);
   $data = $this->db->get_where('articles',array('id_facture'=>$primary_key))->row_array();
   
   $output=$crud1->render();
 
                after : i don't  know

}

 

 

 

Thanks for your support

 

and.. sorry for my poor english

 


jcarlier

jcarlier
  • profile picture
  • Member

Posted 02 November 2015 - 08:56 AM

no answer  from a specialist .??


marlaaragao

marlaaragao
  • profile picture
  • Member

Posted 04 November 2015 - 12:44 PM

Try setting your add_action like this:

$crud->add_action('Articles', '' , 'FracturesController/list_articles', 'fa fa-list-alt')

and your function like this:

function list_articles($primary_key) {
  
  $crud1= new Grocery_CRUD(); 
  $crud1->set_table('articles');
  $crud1->where(`id_facture`,$primary_key);

  $output=$crud1->render();

  $this->load->view('YourView', $output);
}

jcarlier

jcarlier
  • profile picture
  • Member

Posted 16 November 2015 - 09:18 AM

ok its resolved

 

many thanks