# Data tables

Every list of records in Phantom (History, Intruder results, findings,
assets, programs, files, payloads, WebSocket messages) behaves the same
way. This page is the standard a new table follows.

## Long lists are virtualized

A list that can hold thousands of rows renders only the rows in view,
with `@tanstack/vue-virtual`: History, Intruder results, payload items
and WebSocket messages. Rows have a fixed height, so scrolling stays
smooth and the scrollbar is exact. Grids built this way announce their
size (`aria-rowcount`) and each rendered row's place (`aria-rowindex`).
Lists that are paged by the backend (programs, assets with **Load
more**, files) or short by nature (findings of one vault) render every
row they hold.

## Sorting

A sortable column has a header button (`PSortHeader`): the first click
sorts by that column in its natural order (names A to Z, dates and sizes
newest or largest first), the next click reverses it. The header says
which column is sorted and how (`aria-sort`), and shows an arrow; other
sortable headers show a faint double arrow on hover. Lists that the
backend pages sort on the backend; lists held whole sort on the client
with a natural comparison (`item2` before `item10`, empty values last,
equal rows in their previous order; `utils/tableSort.ts`).

## Filters

Filters sit above the table as chips (`PFilterChip`, `PFilterGroup`) or
in the sidebar, and a search field narrows by text. A filtered list that
shows nothing says **Nothing matches** and how to widen it, which is not
the same message as a list that is empty.

## Loading, errors and empty lists

`PTableStatus` gives every table the same three states:

- **Loading**: while the first page loads, skeleton rows with
  `role="status"`. A table that already shows rows keeps them while it
  reloads, so a refresh never flashes empty. History shows skeleton rows
  shaped like its columns.
- **Failed**: when loading failed and nothing is shown, the reason and a
  **Try again** button, with `role="alert"`. A reload that fails over
  rows already shown leaves them in place, and a toast says why.
- **Empty**: the torii, a title that says what is missing, a hint that
  says how to get some, and usually the action that does it. When the
  empty list is the whole page (nothing selected yet), its title is the
  page's heading.

## Selection and confirmation

Rows are picked with checkboxes or Ctrl/Shift+click, and a picked set
gets a bar of bulk actions above the table. Every row has a right-click
menu (also Shift+F10 or the menu key) with the same items as its `⋯`
button. Destructive actions are confirmed in the row itself
(`PRowConfirm`), naming what will go; Delete opens the same
confirmation. Bulk actions that cannot be undone ask the same way
before they run.
