Catalog and Columns
A table card is authored as a JSON5 catalog in the body of <@card type="datatables">. The chrome parses it,
lifts it into the view contract and stamps the current contract versions (see
Contract versions). You never hand-author the version numbers.
<@card type="datatables" id="pets" title="Pets">
{
dataUrl: '/console/pets/data',
dataMode: 'server',
defaultOrder: [[0, 'asc']],
columns: [
{ key: 'name', label: 'Name', searchType: 'text' },
{ key: 'status', label: 'Status', searchType: 'enum' },
{ key: 'price', label: 'Price', searchType: 'numeric', searchOperators: ['eq', 'gt', 'lt', 'between'] }
]
}
</@card>
Catalog keys
dataUrl and columns are required; a catalog missing either fails the render with an IllegalArgumentException
naming the card. Each column is an object.
| Key | Meaning |
|---|---|
dataUrl | Same-origin URL the table fetches its rows from. Must be a path, not an absolute cross-origin URL. |
columns[].key (or data) | The row-data property this column reads. |
columns[].label (or title) | The header text. |
columns[].searchType | Makes the column searchable. One of the SearchType wire tokens below. A column without it is not searchable. |
columns[].searchOperators | Optional allow-list narrowing the operators offered for the column. |
columns[].customOperators | Optional [{name, help}] list of extra operators, with the help text the header popup shows. |
defaultOrder, ribbon, dataMode, rowType, pollIntervalMs, columnConfig, cleanAddress, primary | Copied verbatim onto the view metadata when present. |
The dataMode: "server" setting selects server-side processing, driven by juneau-datatables.js. The host must
compose DataTablesMixin; see the module table.
The data endpoint behind dataUrl is an ordinary REST operation that answers a DataTables request. See
DataTables Server-Side Processing for the endpoint and
BeanQuery for the query language it executes.
Search types and operators
Column (in org.apache.juneau.console.views) pairs a column name with a SearchType and an optional
SearchOperatorSet. The search types come from org.apache.juneau.commons.beanquery.SearchType:
searchType | Matches |
|---|---|
text | Case-insensitive contains. |
id | Case-insensitive contains, intended for identifiers. |
numeric | Exact number; range operators and relative offsets such as -24h. |
version | Prefix match on dotted versions. |
timestamp | Exact instant, with range operators and relative offsets. |
enum | One value, case-insensitive. |
boolean | true or false. |
When a column names no operator set it inherits the table-level set, SearchOperatorSet.standard() by default.
Column.effectiveOperators() reports the resolved list, and Column.searchMeta() produces the search block that
goes on the wire (the token plus each operator with its help text).
Column price = Column.create("price")
.label("Price")
.searchType(SearchType.NUMERIC);
Field format
FieldFormat says how a text value is painted into a slot. It is the main sanitization choice for long-form text,
used by regions and detail fields.
| Constant | Wire token | Behavior |
|---|---|---|
TEXT | text | textContent. The default and omitted from the wire. |
MARKDOWN | markdown | Parsed as markdown and copied node by node through an allowlist. Never innerHTML. |
SANITIZED_HTML | sanitizedHtml | Rich HTML the caller has already sanitized; painted through a wider second allowlist. |
SANITIZED_HTML is not a raw-HTML sink. The runtime parses the value into an inert document and copies only
allowlisted elements and attributes, so event-handler attributes, style and srcdoc cannot survive. The contract
is still caller-sanitizes-first. See Security Model.
Field span
FieldSpan is a closed vocabulary (ONE, the default, and FULL, every column the grid is currently rendering)
that sets how many grid columns a detail field occupies. It maps to a framework class; an author never supplies a CSS value.
Authoring surface for actions and selection
Row actions, selection and bulk mutation are documented on their own page. Note that the catalog lift copies only the keys in the table above. The action, selection and bulk beans are the wire-contract types for those features; check that page for how they reach a page today.