@View
Configures how a field is displayed as a column in the list table, including the column title, width, display type, sorting, and more.
Attributes
| Attribute | Description |
|---|---|
title | Column header title |
desc | Column description |
type | Data display type, defaults to AUTO, see the type table below |
show | Whether to display the column, defaults to true |
sortable | Whether clicking the column header sorts the table, defaults to false |
group | Header group: adjacent columns sharing the same group are merged under one parent header cell, forming a multi-level header (2.3.0+) |
export | Whether to include in Excel exports, defaults to true |
width | Column width with unit, e.g. 200px, 20% |
column | When the field is an object type, specifies the property name to display (commonly used with @ManyToOne) |
className | CSS class name applied to the column |
tpl | Opens a custom template in a popup; the row variable is available inside the template to access current row data |
ifRender | Dynamically controls whether the column is rendered (ExprBool), see ifRender Dynamic Rendering |
template | Column value formatting template (a JS expression evaluated by eval on the frontend); available variables: value (current cell value), item (full row data), item.xxx (specific column value) |
statistic | Column statistic: COUNT / DISTINCT_COUNT / SUM / AVG / MAX / MIN, shown in a totals bar under the table over the whole query result, defaults to NONE, see statistic Column Statistics (2.4.0+) |
Display Types (ViewType)
Text & Number12
AUTOAutomatically inferred from the @Edit type or field typeTEXTPlain textSAFE_TEXT1.12.11+Text containing scripts or tags is not rendered, preventing XSSNUMBERNumeric displayBOOLEANBoolean value displayCOLORRenders a hex color value as a color swatch; inferred automatically when the edit type is COLORICON2.3.0+Renders an icon from its Font Awesome class nameKEY_VALUE2.3.0+Renders a JSON object as one "key: value" tag per pairPASSWORD2.0.4+Password mask; the actual value is replaced with a placeholder and never sent to the clientDATEDate formatted displayDATE_TIMEDate-time formatted displayPROGRESS2.0.4+Progress bar; when the edit type is SLIDER the max value comes from SliderType.max, otherwise 100Image & Media6
IMAGEImageAVATAR2.3.0+Round avatar thumbnail: 32px in tables, 120px in detail view; silhouette placeholder when emptyIMAGE_BASE64Base64-encoded imageQR_CODEQR codeMAPMap displaySWFFlash animationLink & Attachment5
LINKOpens a link in a new windowLINK_DIALOGOpens a link in a dialogDOWNLOADDirect downloadATTACHMENTOpens an attachment in a new windowATTACHMENT_DIALOGOpens an attachment in a dialogRich Content5
HTMLRenders an HTML fragmentMOBILE_HTMLRenders HTML at mobile screen dimensionsCODESyntax-highlighted code displayMARKDOWNRendered Markdown displayTAB_VIEWOne-to-many / many-to-many sub-table displaygroup Multi-level Headers v2.3.0+
Adjacent columns with the same group value are folded under one parent header cell, producing a two-level header:
@EruptField(views = @View(title = "Unit Price", group = "Amount"))
private BigDecimal price;
@EruptField(views = @View(title = "Quantity", group = "Amount"))
private Integer quantity;
@EruptField(views = @View(title = "Total", group = "Amount"))
private BigDecimal total;The group text is translated like title; fixed columns and lone members (a group with a single column) stay ungrouped, and the column settings panel keeps operating on the flat column list.
statistic Column Statistics v2.4.0+
Declaring statistic on a column adds a totals bar under the table showing that column's aggregate. The aggregate covers every row the list query matches, not the current page: search conditions, @Filter and link-tree filters all affect it, paging does not.
@EruptField(views = @View(title = "Amount", statistic = View.Statistic.SUM))
private BigDecimal amount;
@EruptField(views = @View(title = "Quantity", statistic = View.Statistic.AVG))
private Integer quantity;
@EruptField(views = @View(title = "Customer", statistic = View.Statistic.DISTINCT_COUNT))
private String customer;| Value | Description |
|---|---|
NONE | No statistic (default) |
COUNT | Number of non-null values |
DISTINCT_COUNT | Number of distinct non-null values |
SUM | Sum, for numeric columns |
AVG | Average, for numeric columns |
MAX | Maximum |
MIN | Minimum |
How It Works
- Alongside the list request the frontend calls
POST /erupt-api/data/aggregate/{erupt}with the same body as the list (TableQuery: search conditions, link-tree value, view code) and receives a map of column name to aggregated value - The JPA data source folds every statistic column into one aggregate query; the JDBC, SQLite (designer) and MongoDB data sources run their own native aggregates
- Columns the data source cannot aggregate (a
@Transientfield, a computed column filled inDataProxy.afterFetch) fall back to an in-memory computation over at most 2000 rows; beyond that the column reports unknown (null) rather than a value computed over a partial set. Persistent columns are not affected by the cap - Models hosted on a remote node (erupt-cloud) return no statistics
- A column pointing at a property of a referenced entity (
@View(column = "name")) can be aggregated as well - In a grouped TABLE view, columns with a
statisticalso show a per-group subtotal in every group header
TIP
Numbers in the totals bar use locale formatting (thousands separators, at most 2 decimals); an unknown value shows as -.