Datatable
A native keyed table with server sorting, search and pagination reflected into a shareable URL.
Click a column to sort; click it again to reverse the applied direction.
Each preview is its own Live page in a frame, because this site is a Vue 3.5 app built on the Pulsar starter kit. An open list or popover stays inside its frame; in your application it opens over the page.
Installation
suprnova live:add datatableUsage
{% import "suprnova-ui/datatable/datatable.html" as datatable %}
{% call datatable::datatable("invoices", "Invoices", 0) %}{% call datatable::datatable_body() %}<tr><td>No invoices.</td></tr>{% endcall %}{% endcall %}Examples
Search and empty results
The server searches demo invoices and keeps a native empty row when nothing matches.
Paged results
Sort, search and page through fourteen invoices; the preview URL reproduces the state.
Keyboard and accessibility
suprnova.datatable - a native table whose sort, filter and page state the island reflects into the URL (DATA-005). The column macro takes the applied sort key and the direction word (ascending or descending), which the island holds, so the view stays under the checker's branch limit. The sort and filter inputs bind the island's `sort` and `filter` model fields through `live:model`, which the runtime proposes on submit; the submit carries `prevent`, so the form never also submits natively. Sort and filter are Live submits on the island's model fields; the reflected query is shareable and the document mounts the table from it. Rows render inside a loop, so keys pass through live_key; the island exposes `pub mod filters { pub use suprnova::view::filters::live_key; }`.
API reference
datatable
| Parameter | Default | Description |
|---|---|---|
id | Required | The unique native table id. |
caption | Required | The table caption describing the rows. |
count | Required | The matching row count across all pages. |
datatable_head
No parameters.
datatable_column
| Parameter | Default | Description |
|---|---|---|
key | Required | The column key proposed to the sort model field. |
text | Required | The visible sort button label. |
sort | Required | The applied sort column; a match adds aria-sort. |
direction | Required | The applied aria-sort word: ascending or descending. |
action | "sort" | The server action submitted by the sort form. |
datatable_heading
| Parameter | Default | Description |
|---|---|---|
text | Required | The text of a column header without a sort action. |
datatable_body
No parameters.
datatable_row
| Parameter | Default | Description |
|---|---|---|
key | Required | The stable row domain key, encoded through live_key. |
datatable_row_heading
| Parameter | Default | Description |
|---|---|---|
text | Required | The row header text, rendered with scope=row. |
datatable_cell
| Parameter | Default | Description |
|---|---|---|
text | Required | The displayed cell value. |
numeric | false | Whether to align the cell as a numeric value. |
datatable_filter
| Parameter | Default | Description |
|---|---|---|
table | Required | The table id used to derive the unique filter input id. |
label | Required | The search region and input label. |
value | Required | The current filter model value. |
action | "filter" | The server action submitted by the search form. |
