Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions 7.x-dev/base-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ Note that you can further customize this using custom attributes. If you define

<hr>

<a name="datatable"></a>
### 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
<x-datatable controller="\App\Http\Controllers\InvoiceCrudController" />
```

The datatable will pick up everything that in your `setupListOperation()`. You can then further add/remove/configure functionality using the configuration closure:

```html
<x-datatable
controller="\App\Http\Controllers\InvoiceCrudController"
<!-- optional -->
:setup="function($crud, $parent) { if ($parent) { $crud->addClause('where', 'customer_id', $parent->id); } }"
name="invoices"
/>
```

<hr>


<a name="menu-separator"></a>
### Menu Separator
Expand Down
21 changes: 21 additions & 0 deletions 7.x-dev/base-widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,27 @@ class ChartjsPieController extends ChartController

<hr>

<a name="datatable"></a>
### 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);
}
}
]
```


<hr>

<a name="div"></a>
### Div
Expand Down
5 changes: 4 additions & 1 deletion 7.x-dev/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ No changes needed.
<a name="views"></a>
### 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`.

<a name="security"></a>
### Security
Expand Down