Workflow
Filters Outside

This example shows Filters "Outside".

(This Table is a variation of the "Filter Inline" example.)

XLSX
Csv
ID
Dish
Calories
Category
Chef
Price
Diet
In Stock
Created At
ID
Dish
Calories
Category
Chef
Price
Diet
In Stock
Created At
1
Arkansas Possum Pie
718 kcal
Pasta
R$Β 279,94
πŸ₯œ Suitable for Celiacs
Out of Stock
03/04/2024
2
Albacore Tuna Melt
285 kcal
Soup
R$Β 97,76
πŸ₯œ Suitable for Celiacs
In Stock
18/05/2024
3
Π±ΠΎΡ€Ρ‰
393 kcal
Soup
Dan
R$Β 100,19
🌱 Suitable for Vegans
Out of Stock
30/04/2024
4
Bacalhau com natas
709 kcal
Fish
Dan
R$Β 257,80
🌱 Suitable for Vegans
Out of Stock
21/04/2024
5
Baba Ghanoush
304 kcal
Meat
R$Β 234,59
🌱 Suitable for Vegans
Out of Stock
01/05/2024
6
Bacon Cheeseburger
291 kcal
Fish
R$Β 118,06
🌱 Suitable for Vegans
Out of Stock
17/05/2024
7
Baked potato
222 kcal
Fish
R$Β 156,36
🌱 Suitable for Vegans
In Stock
13/04/2024
8
Baklava
847 kcal
Garnish
R$Β 174,31
πŸ₯œ Suitable for Celiacs
In Stock
21/04/2024
9
Bangers and mash
434 kcal
Meat
R$Β 193,81
πŸ₯œ Suitable for Celiacs
In Stock
03/04/2024
10
Black Pudding
600 kcal
Meat
Luan
R$Β 108,28
🍽️ All diets
In Stock
18/05/2024
Disclaimer: Table data is randomly generated for illustrative purposes only. The information here is not a reflection of the actual market and does not constitute business, financial, or medical advice.
πŸ”Ž View on GitHub
<?php
 
namespace App\Livewire\Examples\FiltersOutsideTable;
 
use App\Livewire\Examples\FiltersInlineTable\FiltersInlineTable;
use App\Models\Dish;
use Illuminate\Database\Eloquent\Builder;
use PowerComponents\LivewirePowerGrid\Exportable;
use PowerComponents\LivewirePowerGrid\Footer;
use PowerComponents\LivewirePowerGrid\Header;
 
final class FiltersOutsideTable extends FiltersInlineTable
{
public bool $showFilters = true;
 
public function boot(): void
{
config(['livewire-powergrid.filter' => 'outside']);
}
 
public function setUp(): array
{
return [
Exportable::make('export')
->striped()
->type(Exportable::TYPE_XLS, Exportable::TYPE_CSV),
 
Header::make()
->showToggleColumns()
->withoutLoading()
->showSearchInput(),
 
Footer::make()
->showPerPage()
->showRecordCount(),
];
}
 
public function datasource(): Builder
{
return Dish::query()
->when(
$this->categoryId,
fn ($builder) => $builder->whereHas(
'category',
fn ($builder) => $builder->where('category_id', $this->categoryId)
)
->with(['category', 'kitchen'])
);
}
}
Code highlighting provided by Torchlight.dev

Here you can find all relevant packages installed on this demo.

Name
Version
Description
laravel/framework
v11
The Laravel Framework.
livewire/livewire
v3.5.0
A front-end framework for Laravel.
openspout/openspout
v4.24.1
PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
power-components/livewire-powergrid
5.x-dev
PowerGrid generates Advanced Datatables using Laravel Livewire.