Skip to content

@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 ​

AttributeDescription
titleColumn header title
descColumn description
typeData display type, defaults to AUTO, see the type table below
showWhether to display the column, defaults to true
sortableWhether clicking the column header sorts the table, defaults to false
groupHeader group: adjacent columns sharing the same group are merged under one parent header cell, forming a multi-level header (2.3.0+)
exportWhether to include in Excel exports, defaults to true
widthColumn width with unit, e.g. 200px, 20%
columnWhen the field is an object type, specifies the property name to display (commonly used with @ManyToOne)
classNameCSS class name applied to the column
tplOpens a custom template in a popup; the row variable is available inside the template to access current row data
ifRenderDynamically controls whether the column is rendered (ExprBool), see ifRender Dynamic Rendering
templateColumn 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)
statisticColumn 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 type
AaTEXTPlain text
🛡️SAFE_TEXT1.12.11+Text containing scripts or tags is not rendered, preventing XSS
42NUMBERNumeric display
✓BOOLEANBoolean value display
■COLORRenders a hex color value as a color swatch; inferred automatically when the edit type is COLOR
★ICON2.3.0+Renders an icon from its Font Awesome class name
⋮KEY_VALUE2.3.0+Renders a JSON object as one "key: value" tag per pair
••••PASSWORD2.0.4+Password mask; the actual value is replaced with a placeholder and never sent to the client
📅DATEDate formatted display
🕐DATE_TIMEDate-time formatted display
PROGRESS2.0.4+Progress bar; when the edit type is SLIDER the max value comes from SliderType.max, otherwise 100

Image & Media6

🖼️IMAGEImage
👤AVATAR2.3.0+Round avatar thumbnail: 32px in tables, 120px in detail view; silhouette placeholder when empty
🖼️IMAGE_BASE64Base64-encoded image
▦QR_CODEQR code
📍MAPMap display
⚡SWFFlash animation

Link & Attachment5

🔗LINKOpens a link in a new window
🔗LINK_DIALOGOpens a link in a dialog
⬇️DOWNLOADDirect download
📎ATTACHMENTOpens an attachment in a new window
📎ATTACHMENT_DIALOGOpens an attachment in a dialog

Rich Content5

</>HTMLRenders an HTML fragment
📱MOBILE_HTMLRenders HTML at mobile screen dimensions
{ }CODESyntax-highlighted code display
M↓MARKDOWNRendered Markdown display
▤TAB_VIEWOne-to-many / many-to-many sub-table display

group 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:

java
@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.

java
@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;
ValueDescription
NONENo statistic (default)
COUNTNumber of non-null values
DISTINCT_COUNTNumber of distinct non-null values
SUMSum, for numeric columns
AVGAverage, for numeric columns
MAXMaximum
MINMinimum

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 @Transient field, a computed column filled in DataProxy.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 statistic also 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 -.

Contributors

The avatar of contributor named as YuePeng YuePeng

Changelog

Released under the Apache-2.0 License.