⚠ 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

Display data from mysql



gede bhama
  • profile picture
  • Member

Posted 24 October 2014 - 15:48 PM

Hii All

is posible display the data like below in GROCERYCRUD ?

 

MENU NAME                           Action

----------------------------------------------------

title                                        edit | delete

----------------------------------------------------

   - sub title 1                          edit | delete

----------------------------------------------------

   - sub title 2                          edit | delete

----------------------------------------------------

massage                               edit | delete

----------------------------------------------------

   - sub massage 1                 edit | delete

----------------------------------------------------

   - sub massage 2                 edit | delete

----------------------------------------------------

        - sub massage 2_1        edit | delete

----------------------------------------------------

        - sub massage 2_2        edit | delete

----------------------------------------------------

 

I have try like this :

my controller

-----------------

public function menu()
    {
        $crud = new grocery_CRUD();

        $crud->set_table('tbl_menu');
        $crud->set_subject('tbl_menu');
        $crud->set_relation('id','tbl_menu','parent');

 

        $output = $crud->render();

        $this->_example_output($output);
    }

 

But the data can not display like above.

 

my table name is 'tbl_menu' and the data is:

 

id                    parent                   menu_name

------------------------------------------------------------------

1                     0                            title

2                     1                            sub title 1

3                     1                            sub title 2

4                     0                            massage

5                     4                            sub massage 1

6                     5                            sub massage 2

7                     6                            sub massage 2_1

8                     6                            sub massage 2_2

 

 

 

Please help me..