diff --git a/7.x-dev/base-components.md b/7.x-dev/base-components.md index 8f61b76..6f198f7 100644 --- a/7.x-dev/base-components.md +++ b/7.x-dev/base-components.md @@ -46,6 +46,28 @@ Note that you can further customize this using custom attributes. If you define
+ +### DataTable + +Show a datatable _anywhere you want_, so the admin to easily list, filter, search and perform other operations on entries of an Eloquent model. The datatable component is a extension of a CrudController - so a CRUD for that entity needs to be already set up, and passed to this component as a parameter: + +```html + +``` + +The datatable will pick up everything that in your `setupListOperation()`. You can then further add/remove/configure functionality using the configuration closure: + +```html + + :setup="function($crud, $parent) { if ($parent) { $crud->addClause('where', 'customer_id', $parent->id); } }" + name="invoices" + /> +``` + +
+ ### Menu Separator diff --git a/7.x-dev/base-widgets.md b/7.x-dev/base-widgets.md index d984ee6..a1d1a5b 100644 --- a/7.x-dev/base-widgets.md +++ b/7.x-dev/base-widgets.md @@ -349,6 +349,27 @@ class ChartjsPieController extends ChartController
+ +### DataTable + +Shows a datatable component from a particular CrudController. For more info about the configuration parameter, please see the [datatable component docs](/docs/{{version}}/base-components#datatable). + +```php +[ + 'type' => 'datatable', + 'controller' => 'App\Http\Controllers\Admin\PetShop\InvoiceCrudController', + 'name' => 'invoices', + 'setup' => function($crud, $parent) { + // you can use this closure to modify your CrudController definition. + if ($parent) { + $crud->addClause('where', 'owner_id', $parent->id); + } + } +] +``` + + +
### Div diff --git a/7.x-dev/upgrade-guide.md b/7.x-dev/upgrade-guide.md index ed34d99..b48b3ed 100644 --- a/7.x-dev/upgrade-guide.md +++ b/7.x-dev/upgrade-guide.md @@ -109,7 +109,10 @@ No changes needed. ### Views -No changes needed. +**List Operation View** - The List Operation view got a huge change. We decoupled the datatable from the view, so that you can use the table anywhere you would like. +Most of the code is still identical but moved to `datatable.blade.php`. The `list.blade.php` view now only includes the mentioned datatable component. + +If you had customized the `list.blade.php` you should move your customizations to `datatable.blade.php`. ### Security