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
419 kcal
Garnish
R$ 243,39
🍽️ All diets
In Stock
06/07/2024
2
Albacore Tuna Melt
530 kcal
Pie
Vitor
R$ 63,11
🍽️ All diets
In Stock
03/07/2024
3
борщ
835 kcal
Soup
Dan
R$ 100,19
🍽️ All diets
Out of Stock
26/06/2024
4
Bacalhau com natas
560 kcal
Garnish
Dan
R$ 238,11
🍽️ All diets
Out of Stock
02/06/2024
5
Baba Ghanoush
750 kcal
Pasta
Vitor
R$ 143,09
🌱 Suitable for Vegans
Out of Stock
30/05/2024
6
Bacon Cheeseburger
579 kcal
Fish
R$ 257,39
🍽️ All diets
In Stock
13/06/2024
7
Baked potato
747 kcal
Garnish
R$ 171,89
🌱 Suitable for Vegans
Out of Stock
05/07/2024
8
Baklava
120 kcal
Dessert
R$ 143,46
🥜 Suitable for Celiacs
Out of Stock
14/07/2024
9
Bangers and mash
138 kcal
Dessert
Luan
R$ 253,72
🌱 Suitable for Vegans
In Stock
26/05/2024
10
Black Pudding
660 kcal
Pasta
Dan
R$ 248,73
🥜 Suitable for Celiacs
Out of Stock
10/07/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.
<?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.4
A front-end framework for Laravel.
openspout/openspout
v4.24.3
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.