laravel-livewire-tables
laravel-livewire-tables copied to clipboard
Add multiple columns filtering
This code create a multiple searches, used to filter different values in different columns.
Run method singleSearchable() in all columns you want filter. This create one tag for each column defined.
You can use singleSearchable(), searchable() or both
public function columns()
{
return [
Column::make("#",'id')->searchable()->sortable(),
Column::make("Name",'first_name')->singleSearchable()->sortable(),
Column::make("Last Name",'last_name')->singleSearchable()->searchable()->sortable(),
];
}
Define thSearchClass() method if you want add a class into wrapper input filter. For example
public function thSearchClass($attribute) {
return "myclass";
}
automatically the view result will be
<div class="myclass">
<input type="text" class="form-control" wire:model="single_searchable_cols.first_name" placeholder="Name">
</div>