> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tablepro.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Grid

> Sort, filter, edit, and copy query results in a spreadsheet-style grid

# Data Grid

Query results and table data open in a spreadsheet-style grid. Sort and filter columns, edit cells inline, and copy in several formats.

<Frame caption="Data grid with query results">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/data-grid.png" alt="Data grid" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/data-grid-dark.png" alt="Data grid" />
</Frame>

## View Modes

Switch between **Data**, **Structure**, and **JSON** in the status bar. Query tabs show Data and JSON only. The mode is remembered per tab.

JSON mode shows the rows as a JSON array, with **Text** and **Tree** views. Select rows in Data mode first to limit what JSON shows, then use **Copy JSON**.

## Columns

### Sort

Click a header to cycle through ascending, descending, and off. Sort re-runs the query with `ORDER BY` appended, replacing any existing one.

To sort on open, set **Settings > Data Grid > Default row sort** to **Primary key** or **First column** (default is **No sorting**). A click on any header still overrides it.

<Note>
  If the sort column can't be ordered on the server (a `BLOB`, `JSON`, or spatial column), the query fails. Pick another column or set the default back to No sorting.
</Note>

### Filter by Value

Filter the loaded rows by picking values, without re-querying. Hover a header and click the funnel icon, or right-click the header and choose **Filter Values…**.

The popover lists each value in the column with its count. Search to narrow the list, check the values to keep, and click **Apply**. NULL and empty values appear as their own entries. `Return` applies, `Escape` cancels.

Filter several columns at once and the grid shows rows that match every filter. Clear from the header menu (**Clear Value Filter**, **Clear All Value Filters**) or check **Select All** in the popover.

<Frame caption="Filter a column by its values">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/value-filter-popover.png" alt="Value filter popover" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/value-filter-popover-dark.png" alt="Value filter popover" />
</Frame>

<Note>
  This filter runs on the rows already loaded, so it covers the current page only. To filter the whole table on the server, use the [Filter Panel](/features/filtering).
</Note>

### Resize and Hide

Drag a column border to resize, or double-click it to fit the content. Widths are saved per table.

Hide columns from the columns button in the status bar or the header menu. A hidden column isn't fetched, so hiding a large column makes the table load faster. The primary key is always fetched, so editing still works.

### Display Format

UUIDs and Unix timestamps render in a readable form when the column type and name match (for example a `BINARY(16)` column named `uuid`, or a `BIGINT` named `created_at`). Right-click a header and choose **Display As** to set the format per column. Toggle the automatic behavior in **Settings > Editor > Smart value detection**.

## Editing

<Warning>
  Editing works on simple `SELECT * FROM table` queries. Joins, aggregations, and [Safe Mode](/features/safe-mode) connections are read-only.
</Warning>

Double-click a cell to edit it. Press `Enter` to confirm or `Escape` to cancel. Some types open a dedicated editor:

| Column type                     | Editor                                            |
| ------------------------------- | ------------------------------------------------- |
| Date, time, datetime, timestamp | Calendar and time picker, or edit as text         |
| Foreign key                     | Searchable list of referenced values              |
| Boolean, `BIT`, `TINYINT(1)`    | Checkbox, with a third state for nullable columns |
| `ENUM`                          | Searchable value list                             |
| `SET` (MySQL/MariaDB)           | Multi-select checkboxes                           |
| `JSON`, `JSONB`                 | Text and Tree viewer                              |
| `BLOB`, binary                  | Hex editor (read-only over 10 KB)                 |

<Frame caption="Type-specific cell editor">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/date-picker-editor.png" alt="Cell editor" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/date-picker-editor-dark.png" alt="Cell editor" />
</Frame>

### Foreign Keys

Foreign key cells show an arrow on the right edge. Click it to open the referenced table filtered to the matching row; `Cmd`-click opens a new tab. Right-click for **Preview Referenced Row**, which shows the row in a popover.

<Frame caption="Foreign key lookup">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/fk-lookup-popover.png" alt="Foreign key lookup" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/fk-lookup-popover-dark.png" alt="Foreign key lookup" />
</Frame>

### Add, Delete, and Fill

* **Add a row**: click **+** in the status bar.
* **Delete rows**: select rows by their row number (`Shift`-click for a range, `Cmd`-click for separate rows) and press `Delete`.
* **Fill a column**: right-click a header and choose **Fill Column** to set one value across all loaded rows. It skips primary key columns.

### Saving Changes

Edits are queued, not applied right away. The toolbar shows the pending count, modified cells are highlighted, and new and deleted rows are marked.

* **Preview SQL** (`Cmd+Shift+P`): review the statements before applying.
* **Commit** (`Cmd+S`): apply all pending changes.
* **Discard**: drop all pending changes.
* **Undo / Redo** (`Cmd+Z` / `Cmd+Shift+Z`): step through edits before committing.

See [Change Tracking](/features/change-tracking) for details.

## Cell Inspector

Toggle the inspector with `Cmd+Shift+B`. With a row selected, it lists every column value with a full editor for long text and JSON. With no row selected, it shows table metadata: row count, size, engine, charset, and collation.

<Frame caption="Cell Inspector">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/cell-inspector.png" alt="Cell Inspector" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/cell-inspector-dark.png" alt="Cell Inspector" />
</Frame>

## Select and Copy

Click a cell to select it, drag or `Shift`-click for a range, and click row numbers for whole rows.

* `Cmd+C`: the focused cell, or the selected rows as TSV.
* `Cmd+Shift+C`: the selected rows as TSV.
* `Cmd+Option+J`: the selected rows as JSON.

Right-click a row and choose **Copy as** for more formats:

| Format                 | Output                                     |
| ---------------------- | ------------------------------------------ |
| With Headers           | TSV with a header row                      |
| JSON                   | Array of row objects                       |
| CSV / CSV with Headers | RFC 4180 CSV                               |
| Markdown               | Markdown table                             |
| IN Clause              | `('a', 'b', 'c')` for `WHERE col IN (...)` |
| INSERT / UPDATE        | SQL statements per row (SQL databases)     |

Copies follow the grid as shown: hidden columns are left out and columns keep their current order. **Copy as UPDATE** always includes the primary key. Right-click a header and choose **Copy Column Values** to copy a whole column, one value per line.

<Frame caption="Copy options">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/copy-context-menu.png" alt="Copy options" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/copy-context-menu-dark.png" alt="Copy options" />
</Frame>

## Pagination and Limits

**Table tabs** page through data. The status bar has a rows-per-page menu (5 to 1,000, a custom size, or **All rows**) and First / Previous / Next / Last controls. Set the default in **Settings > Editor**. Smaller pages load faster.

<Frame caption="Pagination controls">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/pagination-controls.png" alt="Pagination controls" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/pagination-controls-dark.png" alt="Pagination controls" />
</Frame>

**Query tabs** cap results at 10,000 rows by default to stay responsive. When the cap applies, the status bar shows **Fetch All** to load the rest (with a confirmation, since large results use a lot of memory). Your own `LIMIT` and `OFFSET` are passed through unchanged. Adjust the cap in **Settings > Editor** (**Truncate query results**, **Row cap**).

Press `Cmd+.` to cancel a running query or a Fetch All.

## Display Settings

NULL shows as styled `NULL` text. Set the NULL display, date format, row height, and alternate row colors in **Settings > Editor**.

## MongoDB Collections

MongoDB has no fixed schema, so TablePro infers columns by sampling up to 500 documents. Missing fields show as NULL, and the `_id` column is read-only (delete and re-insert to change it). BSON values display as `ObjectId("...")`, ISO 8601 dates, `BinData(...)`, decimal strings, and `DBRef(...)`.

Changes preview as shell commands: `insertMany`, `updateOne` with `$set`, and `deleteMany`.
