type

GridBuilder

@Js
class GridBuilder : Obj

GridBuilder is used to build up an immutable Grid. To use first define your cols via addCol and then add the rows via addRow:

gb := GridBuilder()
gb.addCol("a").addCol("b")
gb.addRow(["a-0", "b-0"])
gb.addRow(["a-1", "b-1"])
grid := gb.toGrid

methods

addCol

Add column to the grid.

addColNames

Add list of column names to the grid.

addDictRow

Add dict as a new row to the grid.

addDictRows

Convience for adding a list of addDictRow.

addGridRows

Add all the rows of given grid as rows to our grid

addRow

Add list of cells as a new row to the grid.

numCols

Number of columns added to the grid

numRows

Number of rows added to the grid

setMeta

Set the grid meta (overwrites any current meta) The meta parameter can be any Etc.makeDict value.

toGrid

Construct to finalized grid

Slot Details

addCol

This addCol(Str name, Obj? meta := null)

Add column to the grid. The meta parameter can be any Etc.makeDict value.

addColNames

This addColNames(Str[] names)

Add list of column names to the grid.

addDictRow

This addDictRow(Dict? row)

Add dict as a new row to the grid. All the dict tags must have been defined as columns.

addDictRows

This addDictRows(Dict?[] rows)

Convience for adding a list of addDictRow.

addGridRows

This addGridRows(Grid grid)

Add all the rows of given grid as rows to our grid

addRow

This addRow(Obj?[] cells)

Add list of cells as a new row to the grid. The cell list size must match the number of columns.

numCols

Int numCols()

Number of columns added to the grid

numRows

Int numRows()

Number of rows added to the grid

setMeta

This setMeta(Obj? meta)

Set the grid meta (overwrites any current meta) The meta parameter can be any Etc.makeDict value.

toGrid

Grid toGrid()

Construct to finalized grid