Beartropy Tables
Custom Options
You can add an additional button next to the column toggle to display a list of custom options/actions.
This options/actions will 'wire:click' the key given.
In this example, when user clicks on 'Delete selected rows' the function 'remove' will be called.
Make sure you implement this functions in your component in order to avoid errors.
1public function options(): array { 2 return [ 3 'export' => 'Export selected rows', 4 'remove' => 'Delete selected rows', 5 ]; 6} 7 8public function remove() { 9 foreach ($this->getSelectedRows() as $id) {10 $this->removeRowFromTable($id);11 }12}
Export Data
You have three methods available to handle data export:
If you have Laravel Excel, the stub comes with functions pre-configured in the Options dropdown.
1// Returns collection of all data2$this->getAllData();3 4// Returns collection of filtered data (global search and custom filters)5$this->getAfterFiltersData();6 7// Returns collection of data by selected rows8$this->getSelectedData();