rappasoft/laravel-livewire-tables
Laravel Livewire Tables provides dynamic, feature-rich data tables for Laravel Livewire with sorting, searching, filtering, pagination, bulk actions, and Bootstrap/Tailwind support. Build reusable table components backed by Eloquent queries.
These are the available configuration methods for pagination.
Set the page name for the component's pagination, defaults to page.
public function configure(): void
{
$this->setPageName('users');
}
Enabled by default, enable/disable pagination for the component.
public function configure(): void
{
$this->setPaginationStatus(true);
$this->setPaginationStatus(false);
}
Enable pagination for the component.
public function configure(): void
{
// Shorthand for $this->setPaginationStatus(true);
$this->setPaginationEnabled();
}
Disable pagination for the component.
public function configure(): void
{
// Shorthand for $this->setPaginationStatus(false);
$this->setPaginationDisabled();
}
Enabled by default, enable/disable pagination visibility.
public function configure(): void
{
$this->setPaginationVisibilityStatus(true);
$this->setPaginationVisibilityStatus(false);
}
Enable pagination visibility.
public function configure(): void
{
// Shorthand for $this->setPaginationVisibilityStatus(true);
$this->setPaginationVisibilityEnabled();
}
Disable pagination visibility.
public function configure(): void
{
// Shorthand for $this->setPaginationVisibilityStatus(false);
$this->setPaginationVisibilityDisabled();
}
Enabled by default, enable/disable per page visibility.
public function configure(): void
{
$this->setPerPageVisibilityStatus(true);
$this->setPerPageVisibilityStatus(false);
}
Enable per page visibility.
public function configure(): void
{
// Shorthand for $this->setPerPageVisibilityStatus(true);
$this->setPerPageVisibilityEnabled();
}
Disable per page visibility.
public function configure(): void
{
// Shorthand for $this->setPerPageVisibilityStatus(false);
$this->setPerPageVisibilityDisabled();
}
Set the accepted values for the per page dropdown. Defaults to [10, 25, 50]
public function configure(): void
{
$this->setPerPageAccepted([10, 25, 50, 100]);
}
Note: Set an option of -1 to enable All.
Set the selected option of the per page dropdown.
public function configure(): void
{
$this->setPerPage(10);
}
Set the default selected option of the per-page dropdown, will be over-ridden if set at Session or QueryString level.
public function configure(): void
{
$this->setDefaultPerPage(10);
}
Note: The value set must be included in the per page accepted values.
Set the pagination method. By default, the table will use the paginate method.
You may specify simplePaginate like so:
public function configure(): void
{
$this->setPaginationMethod('simple');
}
You may specify cursorPaginate like so:
public function configure(): void
{
$this->setPaginationMethod('cursor');
}
Returns the Primary Key for the currently visible rows in an array. This should be used in a blade to ensure accuracy.
$this->getPerPageDisplayedItemIds();
Returns the number of rows that are currently displayed. This should be used in a blade to ensure accuracy.
$this->getPerPageDisplayedItemCount();
Enables display of Pagination Details (e.g. Displaying Rows x of y) - default behaviour
public function configure(): void
{
$this->setDisplayPaginationDetailsEnabled();
}
Disables display of Pagination Details (e.g. Displaying Rows x of y)
public function configure(): void
{
$this->setDisplayPaginationDetailsDisabled();
}
Allows for customisation of the appearance of the "Per Page" dropdown
Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods.
Setting to false will disable the default colors for the Per Page dropdown, the default colors are: Bootstrap: None
Tailwind: border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-700 dark:text-white dark:border-gray-600
Setting to false will disable the default styling for the Per Page dropdown, the default styling is: Bootstrap 4: form-control
Bootstrap 5: form-select
Tailwind: block w-full rounded-md shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:ring focus:ring-opacity-50
public function configure(): void
{
$this->setPerPageFieldAttributes([
'class' => 'border-red-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-red-700 dark:text-white dark:border-red-600', // Add these classes to the dropdown
'default-colors' => false, // Do not output the default colors
'default-styles' => true, // Output the default styling
]);
}
Used when "simple" pagination is being used, allows the enabling/disabling of the "total records" count. This may be desirable to disable in larger data sets. This is enabled by default.
public function configure(): void
{
$this->setShouldRetrieveTotalItemCountStatus(false);
}
Used when "simple" pagination is being used, enables the "total records" count.
public function configure(): void
{
$this->setShouldRetrieveTotalItemCountEnabled();
}
Used when "simple" pagination is being used, disables the "total records" count.
public function configure(): void
{
$this->setShouldRetrieveTotalItemCountDisabled();
}
Used to set attributes for the "div" that wraps the pagination section
public function configure(): void
{
$this->setPaginationWrapperAttributes(['class' => 'text-lg']);
}
How can I help you explore Laravel packages today?