⚠ 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

Use same object for multiple times



digraj_sinh
  • profile picture
  • Member

Posted 23 January 2018 - 13:56 PM

https://www.grocerycrud.com/enterprise/examples-3/multiple-grids

 

in above example this way crud object is used.

 

$crud = new GroceryCrud($config, $database);

 

$crud2 = new GroceryCrud($config, $database);

 

 

but what if i want to used this way 

 

$crud = new GroceryCrud($config, $database);

 

$crud = new GroceryCrud($config, $database);

 

so is there any method so I can do $crud->unset; and can reuse that object .... ? i want to load data from mulitple table .. given below is my piece of code

 

foreach ($database_tables as $database_table) {
                $crud->setTable($database_table);
                $result = $crud->render();
                if ($result->isJSONResponse) {
                    header('Content-Type: application/json; charset=utf-8');
                    echo $result->output;
                    exit;
                }
                $css_files = array_merge($result->css_files, $css_files);
                $js_files = array_merge($result->js_files, $js_files);
                $output .= $result->output;
            }

right now if i use this way .... same table is shown.. for multiple times