waifung0207 / ci_bootstrap_3

A multi-tenant website template based on CodeIgniter 3 with integration of some useful tools
MIT License
385 stars 315 forks source link

Grocery_CRUD in view #81

Open XpamAmAdEuS opened 8 years ago

XpamAmAdEuS commented 8 years ago

Hi. I am having issues with position of CRUD in view. Is there a way to set CRUD inside like this

> <div class="panel panel-default">
>         <div class="panel-heading"><h4 class="text-center">Server settings</h4></div>
>         <div class="panel-body">
> 
> Put crud here ?
> 
> 
>         </div>
>     </div>
waifung0207 commented 8 years ago

To use Grocery CRUD within your custom view (instead of /application/modules/admin/views/crud.php), you can simply skip the Admin_Controller's render_crud() function and pass the CRUD object like:

$crud = $this->generate_crud('users');
$this->mViewData['crud'] = $crud;   // or use $this->mCrud
$this->render('my_view');

But then you will miss some functions from render_crud(), like you will need to add stylesheets / scripts to page manually - for reference please have a look on the render_crud() function from Admin_Controller.php