Skip to content

Grid

A paginated data table. Define columns, supply a Page of rows, and Mateu renders the table with optional sorting, filtering, frozen columns, and tree mode.

Grid.builder()
.content(List.of(
GridColumn.builder().id("id").label("ID").build(),
GridColumn.builder().id("name").label("Name").build(),
GridColumn.builder().id("age").label("Age").build()
))
.page(new Page<>("", 10, 1, rows.size(), rows))
.build()

Rows are List<Map<String, Object>> where each key matches a column id.

PropertyTypeDefaultDescription
idString—Optional component ID
contentList<GridContent>—Column definitions (and optionally group columns)
pagePage<?>—Current page of data
treebooleanfalseEnables tree/hierarchical mode
sizeint0Row count hint
wrapCellContentbooleanfalseWraps long text inside cells
compactbooleanfalseReduces row height
noBorderbooleanfalseRemoves the outer border
noRowBorderbooleanfalseRemoves row separators
columnBordersbooleanfalseShows column separators
rowStripesbooleanfalseAlternates row background colours
styleString—Inline CSS
cssClassesString—CSS class names
new Page<>(
sortProperty, // String — current sort column
pageSize, // int
pageNumber, // int (1-based)
totalItems, // int
rows // List<Map<String, Object>>
)
PropertyTypeDefaultDescription
idString—Maps to the row map key
labelString—Column header text
dataTypeFieldDataTypestringData type for formatting
stereotypeFieldStereotyperegularRendering hint
sortablebooleanfalseEnables column sorting
sortingPropertyString—Alternative sort property
filterablebooleanfalseShows a column filter
frozenbooleanfalseFreezes the column on the left
frozenToEndbooleanfalseFreezes the column on the right
autoWidthbooleanfalseSizes column to content
flexGrowString—CSS flex-grow for column width
widthString—Fixed CSS column width
resizablebooleanfalseAllows the user to resize the column
alignColumnAlignment—start, center, end
actionIdString—Makes cells clickable and fires this action
tooltipPathString—Row property shown as a tooltip
GridColumn.builder()
.id("name").label("Name")
.sortable(true)
.filterable(true)
.build()
GridColumn.builder().id("id").label("ID").frozen(true).width("80px").build()
GridColumn.builder()
.id("name").label("Name")
.actionId("open_detail")
.build()
Grid.builder()
.content(columns)
.page(page)
.compact(true)
.rowStripes(true)
.build()

Supply rows with a children key containing nested rows:

List<Map<String, Object>> rows = List.of(
Map.of("id", "1", "name", "Category A", "children", List.of(
Map.of("id", "1.1", "name", "Item 1"),
Map.of("id", "1.2", "name", "Item 2")
)),
Map.of("id", "2", "name", "Category B", "children", List.of(
Map.of("id", "2.1", "name", "Item 3")
))
);
Grid.builder()
.content(columns)
.page(new Page<>("", 10, 1, rows.size(), rows))
.tree(true)
.build()