Row detail
Override rowDetail() to make a row expandable. Each expandable row gets a chevron that folds a detail
panel open beneath it. The detail is a Fragment loaded over AJAX when the row
opens — nothing is fetched for collapsed rows — so the detail can be as rich as you like without
weighing down the table payload.
use Lattice\Fragments\Components\Fragment;
public function rowDetail(array $row): ?Fragment{ return Fragment::lazy(OrderLinesFragment::class, ['orderId' => $row['id']]);}Return null for rows that should not expand — those rows simply show no chevron.
The detail fragment
Section titled “The detail fragment”The detail lives in its own #[AsFragment] class, authored and tested
independently of the table. It reads the row context you passed to Fragment::lazy():
use Lattice\Core\Attributes\AsFragment;use Lattice\Core\PageSchema;use Lattice\Fragments\FragmentDefinition;
#[AsFragment('order-lines')]final class OrderLinesFragment extends FragmentDefinition{ public function schema(PageSchema $schema): PageSchema { $order = Order::with('lines')->findOrFail($this->context('orderId'));
return $schema->component(/* … the order's lines … */); }}Because it is a real fragment, the detail inherits the whole Fragment pipeline: a signed per-row endpoint, authorization, the loading skeleton, and per-fragment reload events.
Behavior
Section titled “Behavior”- The chevron toggles the row; the rest of the row stays free for row actions and links.
- Several rows can be open at once.
- Expansion is client-side and resets when the table reloads, re-sorts, re-filters, or paginates; the detail re-fetches each time a row opens.