- 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
- 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
Available Methods
These are the available configuration methods on the datatable component.
General
setPrimaryKey
Set the primary key column of the component.
1public function configure(): void2{3 $this->setPrimaryKey('id');4}
useComputedPropertiesDisabled
If you have published the Views prior to v3.4.5, and do not wish to remove the published views, then you should add the following call, which will disable the new Computed Properties behaviour. Note that publishing the views is not recommended!
1public function configure(): void2{3 $this->useComputedPropertiesDisabled();4}
Attributes
Documentation for Data Table Styling/Attributes is now: Here
Offline
Offline indicator is enabled by default, but if you ever needed to toggle it you can use the following methods:
Enable/disable the offline indicator.
setOfflineIndicatorStatus
1public function configure(): void2{3 $this->setOfflineIndicatorStatus(true);4 $this->setOfflineIndicatorStatus(false);5}
setOfflineIndicatorEnabled
Enable the offline indicator.
1public function configure(): void2{3 // Shorthand for $this->setOfflineIndicatorStatus(true)4 $this->setOfflineIndicatorEnabled();5}
setOfflineIndicatorDisabled
Disable the offline indicator.
1public function configure(): void2{3 // Shorthand for $this->setOfflineIndicatorStatus(false)4 $this->setOfflineIndicatorDisabled();5}
Query String
The documentation for Query String now lives: here
Relationships
Disabled by default, enable to eager load relationships for all columns in the component.
setEagerLoadAllRelationsStatus
Enable/disable column relationship eager loading.
1public function configure(): void2{3 $this->setEagerLoadAllRelationsStatus(true);4 $this->setEagerLoadAllRelationsStatus(false);5}
setEagerLoadAllRelationsEnabled
Enable column relationship eager loading.
1public function configure(): void2{3 // Shorthand for $this->setEagerLoadAllRelationsStatus(true)4 $this->setEagerLoadAllRelationsEnabled();5}
setEagerLoadAllRelationsDisabled
Disable column relationship eager loading.
1public function configure(): void2{3 // Shorthand for $this->setEagerLoadAllRelationsStatus(false)4 $this->setEagerLoadAllRelationsDisabled();5}
Builder
setAdditionalSelects
By default the only columns defined in the select statement are the ones defined via columns. If you need to define additional selects that you don't have a column for you may:
Note - that you may only call this once, and it will override any existing additionalSelects in use.
1public function configure(): void2{3 $this->setAdditionalSelects(['users.id as id']);4}
Since you probably won't have an ID
column defined, the ID will not be available on the model to use. In the case of an actions column where you have buttons specific to the row, you probably need that, so you can add the select statement to make it available on the model.
addAdditionalSelects
By default the only columns defined in the select statement are the ones defined via columns. If you need to define additional selects that you don't have a column for you may:
Note - that in contrast to setAdditionalSelects, you may call this multipole times, and it will append the additional selects. Take care not to re-use the same field names!
1public function configure(): void2{3 $this->addAdditionalSelects(['users.id as id']);4}
Misc.
setEmptyMessage
Set the message displayed when the table is filtered but there are no results to show.
Defaults to: "No items found, try to broaden your search."
1public function configure(): void2{3 $this->setEmptyMessage('No results found');4}