Sorting
Call sortable() to make a column sortable:
use InertiaX\Components\Table\Columns\TextColumn;
TextColumn::make('name')->sortable();Set the initial order
Section titled “Set the initial order”On a table with a sortable name column:
UsersTable::make('users')->data($users)->initialSort('name');Prefix the key with - for descending order: initialSort('-name').
Multiple sorting is enabled by default. Supply an ordered list when more than one column should participate; each listed column must be sortable:
UsersTable::make('users')->data($users)->initialSort([ ['key' => 'role', 'direction' => 'asc'], ['key' => 'name', 'direction' => 'desc'],]);Use multiSort(false) to restrict sorting to one column.
Keep a fixed query order
Section titled “Keep a fixed query order”If the query already owns the order, disable interactive sorting:
UsersTable::make('users') ->data($users->latest()) ->sorting(false);For interactive sorting, supply a query without an existing order. InertiaX does not remove application query ordering before adding the table’s sort.
Sorting resets pagination to page 1. See Table API for tie-breakers and validation, or Custom query behavior to sort a different field.