Fluent builder for a TableViewMeta, used to assemble a table's paginator, records, columns and CSS classes step by step in a template or controller before calling build. Normally obtained from Formatter's newTable helper rather than constructed directly.
Group: Builders
Properties
| Property | Returns | Description |
|---|---|---|
| classes | List<String> | The CSS classes added so far for the table element. |
| columns | List<ColumnMetaBuilder> | The column builders added so far, in the order they were added. |
| id | String | Identifier for the table this builder will produce. |
| paginator | Paginator | The paginator currently set on this builder. |
| records | List | The records currently set on this builder. |
| title | String | The title set on this builder. |
Methods
bodyId(String s) · title(String s) · paginator(Paginator p) · records(List records) · selection(boolean b) · column(String id) · addClass(String s) · addClasses(String ss) · getId() · getTitle() · getPaginator() · getRecords() · getColumns() · getClasses() · build()
bodyId(String s)
Returns: TableViewMetaBuilder
Sets the HTML id to render on the table body element.
| Parameter | Description |
|---|---|
s | the body element id |
title(String s)
Returns: TableViewMetaBuilder
Sets the table's title. This is stored on the builder but is not currently carried through to the built TableViewMeta.
| Parameter | Description |
|---|---|
s | the table title |
paginator(Paginator p)
Returns: TableViewMetaBuilder
Sets the paginator describing the current page of records and how to navigate other pages.
| Parameter | Description |
|---|---|
p | the paginator to use, may be null for an unpaged table |
records(List records)
Returns: TableViewMetaBuilder
Sets the rows to render for the current page of the table.
| Parameter | Description |
|---|---|
records | the records for this page |
selection(boolean b)
Returns: TableViewMetaBuilder
Sets whether the table renders a selection checkbox column.
| Parameter | Description |
|---|---|
b | true to enable row selection |
column(String id)
Returns: ColumnMetaBuilder
Adds a new column to the table and returns its builder, so column properties such as title and sortable can be chained off the call.
| Parameter | Description |
|---|---|
id | the column id, used to correlate it with a value on each record |
addClass(String s)
Returns: TableViewMetaBuilder
Adds a single CSS class to render on the table element.
| Parameter | Description |
|---|---|
s | the CSS class name to add |
addClasses(String ss)
Returns: TableViewMetaBuilder
Adds one or more CSS classes to render on the table element.
| Parameter | Description |
|---|---|
ss | the CSS class names to add |
getId()
Returns: String
Identifier for the table this builder will produce.
getTitle()
Returns: String
The title set on this builder.
getPaginator()
Returns: Paginator
The paginator currently set on this builder.
getRecords()
Returns: List
The records currently set on this builder.
getColumns()
Returns: List<ColumnMetaBuilder>
The column builders added so far, in the order they were added.
getClasses()
Returns: List<String>
The CSS classes added so far for the table element.
build()
Returns: TableViewMeta
Builds the immutable TableViewMeta from this builder's current state, building each added column in turn and dropping any column marked not visible.