Skip to content
Open
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
27 changes: 27 additions & 0 deletions docs/table-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,33 @@ public function query($query)
return $query->where('name', 'Like', "%John Doe%")->with('roles', 'permissions');
}
```
### Buttons
You can specify Table based buttons for available options view Datatables https://datatables.net/reference/button/
Note: you must use php array not JSON for example
```public $buttons = [
[
'extend' => 'print',
'text'=> 'Print',
'exportOptions'=> [
'columns'=> [0, ':visible'],
],
],
[
'extend' => 'csv',
'text'=> 'Excel',
'exportOptions'=> [
'columns'=> [0, '=>visible'],
],
'filename'=> 'CustomFileName',
],
'copy',
[
'extend'=> 'colvis',
'className'=> 'btn btn-dark'
]
];
```


### Table triggers
The table triggers an event everytime something is processed. Below is a list of triggers available
Expand Down
1 change: 1 addition & 0 deletions src/resources/views/scripts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ classes["{{ $view->tableId }}"] = new class
order: view.order,
columns: view.columns,
columnDefs: this.buildColumnDefs(view.defs),
buttons: {!! json_encode($view->buttons()) ?? [] !!},
createdRow: (row, data, index) => {

$(row).on('click', (el) => {
Expand Down