Searching
Mark any text column ->searchable() and Lattice renders a search box above the table. Typing filters
rows server-side, matching the term against every searchable column at once. The box appears only when a
table has at least one searchable column.
TextColumn::make('name')->label('Name')->sortable()->searchable();TextColumn::make('email')->label('Email')->link('mailto:{value}')->searchable();TextColumn::make('team')->label('Team');- actionsLabel:null
- bulkActions:[]
- data:[{"email":"[email protected]","name":"Ada Lovelace","team":"Engineering"},{"email":"[email protected]","name":"Grace Hopper","team":"Engineering"},{"email":"[email protected]","name":"Katherine Johnson","team":"Research"}]
- emptyLabel:null
- endpoint:null
- filters:[]
- layout:null
- lazy:false
- pagination:{"currentPage":null,"from":1,"hasMore":false,"lastPage":null,"mode":"none","nextPage":null,"perPage":null,"to":3,"total":3}
- perPageOptions:[]
- query:{"filters":[],"mode":null,"page":1,"perPage":25,"search":"","sorts":[],"tableFilterIndicators":[],"tableFilters":{}}
- resizableColumns:false
- resizeIndicator:false
- searchable:true
- striped:false
- toolbar:[]
- align:"start"
- badge:null
- copyable:false
- date:null
- filter:null
- hiddenByDefault:false
- label:"Name"
- link:null
- multiple:null
- sortable:true
- toggleable:false
- width:"md"
- align:"start"
- badge:null
- copyable:false
- date:null
- filter:null
- hiddenByDefault:false
- label:"Email"
- link:{"external":false,"href":"mailto:{value}"}
- multiple:null
- sortable:false
- toggleable:false
- width:"md"
- align:"start"
- badge:null
- copyable:false
- date:null
- filter:null
- hiddenByDefault:false
- label:"Team"
- link:null
- multiple:null
- sortable:false
- toggleable:false
- width:"md"
Declaring searchable columns
Section titled “Declaring searchable columns”->searchable() opts a column into the global search. It is independent of ->filterable() — a column
can be searchable, filterable, both, or neither:
use Lattice\Table\Columns\TextColumn;
TextColumn::make('name')->searchable();TextColumn::make('email')->searchable()->filterable(); // bothTextColumn::make('internal_note'); // neitherRelation columns are searchable too — a dotted to-one key or a ->multiple() to-many list matches
through whereHas, the same machinery filtering uses:
TextColumn::make('businessPartner.name')->searchable(); // to-one relationTextColumn::make('tags')->multiple('name')->searchable(); // to-many relationHow it matches
Section titled “How it matches”The term is a single, case-insensitive contains match, OR-grouped across the searchable columns and
combined with any active filters using AND — so a search narrows within the
current filter set rather than replacing it. LIKE wildcards in the term are escaped.
The box debounces input and resets to the first page on each change. The term rides the table endpoint
as ?q=…, so it is part of the shareable table state and is respected by bulk “select all matching”
actions.