⚠ 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

Relation 1_n - take all columns of second table



maicol.cantagallo
  • profile picture
  • Member

Posted 29 April 2013 - 10:38 AM

Hi, i have a question...

 

this is the code and...

 

try{
            $crud = new grocery_CRUD();

            $crud->set_theme('flexigrid');                                     
            $crud->set_table('news');                                       
            $crud->set_subject('News');                                     
            $crud->set_relation('category', 'news_categories', 'name');        
            $crud->set_field_upload('image_s','upload_area/');                
            $crud->set_field_upload('image_l','upload_area/');
            $crud->display_as('category','Categoria');                      
            $crud->set_relation('id', 'news_i18n', 'title');               
            $crud->display_as('id','Titolo');
            $crud->display_as('date','Data');
            $crud->display_as('published','Pubblicato');
            $crud->display_as('hp','In homepage');
            
            $crud->fields('id', 'category', 'date', 'published', 'hp');       
            $crud->columns('id', 'lang', 'category', 'date', 'published', 'hp');      

            $output = $crud->render();

            $this->_list_output($output);

        }catch(Exception $e){
                show_error($e->getMessage().' --- '.$e->getTraceAsString());
        }
    }

...if the column "lang" is in 'news_i18n' table, how do I display it?

 

Thanks


jrierab
  • profile picture
  • Member

Posted 29 April 2013 - 11:43 AM

I am new here, so take my advice with some care, but I believe that you should look into the set_model direction. Take a llok at this post.


maicol.cantagallo
  • profile picture
  • Member

Posted 29 April 2013 - 14:36 PM

thank you very much