Sorting & Defaults

Make any column sortable and keep related records together with a default sort applied before user interaction.

$this->setDefaultSort('active', 'desc') // v3 has no groupBy()

Not available in v3

Row grouping is a v4-only feature. Version 3 has no grouping subsystem at all — there is no groupBy(), no groupsExpanded()/groupsCollapsed(), and no group headers or per-group row counts. The live demo below therefore renders a plain table with a default sort on the column that would have been the grouping column, so related rows still appear together.

Example Usage GroupingDemoTable.php
public function configure(): void
{
    $this->setPrimaryKey('id')
        // groupBy() / groupsExpanded() do not exist in v3.
        ->setDefaultSort('active', 'desc');   // Closest v3 equivalent
}

public function columns(): array
{
    return [
        Column::make('ID', 'id')->sortable(),
        Column::make('Name', 'name')->sortable()->searchable(),
        Column::make('Email', 'email')->sortable()->searchable(),
        BooleanColumn::make('Active', 'active')->sortable(),
    ];
}
Visual Group Headers
Click to expand/collapse
Collapsible Groups
groupsCollapsed()
Row Counts
Shows items per group

True Row Grouping (v4 only)

In v4, row grouping creates visual group headers that organize rows by a common value. Each group shows a header with the group label and row count, and the header can be clicked to expand or collapse the group. None of this exists in v3 — the feature cards above describe v4 behaviour only.

Active: true (12 items) → Group header with expand/collapse

Live Demo

Users sorted by Active status (v3 has no group headers to expand/collapse)

Applied Sorting: Active: Z-A
1 Miss Eve Will [email protected] 97%
5 Mr. Austen Harber [email protected] 35%
6 Raegan Pfannerstill PhD [email protected] 60%
7 Dan Ebert [email protected] 21%
8 Mertie Kohler [email protected] 56%
13 Dagmar Gislason [email protected] 39%
14 Frieda Ebert I [email protected] 94%
15 Braulio Brakus [email protected] 18%
19 Dr. Carson Hudson [email protected] 58%
22 Vesta Robel [email protected] 95%
29 Adele Becker [email protected] 75%
32 Prof. Dale Daniel III [email protected] 82%
33 Eveline Balistreri [email protected] 72%
40 Elvera Weissnat [email protected] 21%
41 Austen Grady MD [email protected] 33%
42 Adelle Senger [email protected] 6%
43 Ms. Mya Thompson III [email protected] 30%
44 Suzanne Nolan [email protected] 78%
46 Prof. Stephanie Littel V [email protected] 79%
48 Leif Rau [email protected] 69%
49 Mortimer Rolfson [email protected] 9%
50 Michale Hartmann PhD [email protected] 35%
52 Dr. Norbert Cummerata [email protected] 61%
55 Toby Hand [email protected] 95%
56 Kelvin Dietrich [email protected] 99%

Showing 1 to 25 of results