- Creating Columns
- Relationships
- Available Methods
- Other Column Types
- Column Selection
- Secondary Header
- Footer
- Reusable Columns
- Anonymous Columns
- Styling
- Standard Column
- Array Columns (beta)
- Avg Columns (beta)
- Boolean Columns
- Button Group Columns
- Color Columns
- Component Columns
- Count Columns (beta)
- Date Columns
- Icon Columns (beta)
- Image Columns
- Increment Column (beta)
- Link Columns
- Livewire Component (beta)
- Sum Columns (beta)
- View Component Columns
- Wire Link Column (beta)
- Introduction
- Boolean Filters (beta)
- Date Filters
- DateRange Filters
- DateTime Filters
- Multi-Select Dropdown Filters
- Multi-Select Filters
- NumberRange Filters
- Number Filters
- Select Filters
- Text Filters
- Livewire Custom Filter (Beta)
- Refreshing
- Loading Placeholder
- Multiple Tables Same Page
- Actions (beta)
- Adding Custom Markup
- Debugging
- Saving Table State
- Lifecycle Hooks
- Hiding The Table (beta)
- One Of Many Example
- Tools
Getting Started
Usage
DataTable
Columns
Column Types
Rows
Sorting
Pagination
Search
Bulk Actions
Filters
Filter Types
Reordering
Secondary Header
Footer
Examples
Misc.
Sponsored
Advanced Usage
Examples
🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.
This is the documentation for v3. You can switch versions in the menu on the left/at the top. Check your current version with the following command:
composer show rappasoft/laravel-livewire-tables
Select Filters
Select filters are a simple dropdown list. The user selects one choice from the list.
1use Rappasoft\LaravelLivewireTables\Views\Filters\SelectFilter; 2 3public function filters(): array 4{ 5 return [ 6 SelectFilter::make('Active') 7 ->options([ 8 '' => 'All', 9 'yes' => 'Yes',10 'no' => 'No',11 ]),12 ];13}
The default value
You should supply the first option as the default value. I.e. nothing selected, so the filter is not applied. This value should be an empty string. When this value is selected, the filter will be removed from the query and the query string.
Option Groups
To use <optgroup>
elements, pass a nested array of options to the select filter.
1use Rappasoft\LaravelLivewireTables\Views\Filters\SelectFilter; 2 3public function filters(): array 4{ 5 return [ 6 SelectFilter::make('Active') 7 ->options([ 8 '' => 'All', 9 'Open' => [10 1 => 'Type A',11 2 => 'Type B',12 3 => 'Type C',13 ],14 'Closed' => [15 24 => 'Type X',16 25 => 'Type Y',17 26 => 'Type Z',18 ],19 ])20 ->setFirstOption('All Tags'),21 ];22}
To set a default "All" option at the start of the dropdown, you can do so by utilising the
1->setFirstOption('NAME')