Columns Context
This context class manages the configuration and defines the DSL for the overall declaration of the data table's columns.
The following aspects can be configured:
the styling for all columns (overriding the theme's default)
the individual columns by ColumnContext
This is how the DSL looks like:
columns({ // as first parameter you can pass a style that gets applied to *all* columns
background { color { "purple" } }
color { "white" }
}) { // opens the context for declaring the individual columns
column {
// and so on, Details in [ColumnContext]
}
}The styling gets some meta information injected, an IndexedValue of type `IndexedValue<StatefulItem<T>>`, so that is is possible to react to the row position (odd vs even for example) or to the content itself:
columns({ (index, state) ->
if(item % 2 == 1) { // odd row
background { color { "purple" } }
color { "white" }
} else { // even row
background { color { "pink" } }
color { "black" }
}
if(state.selected) { // emphasize text if row is selected
fontWeight { bold }
}
// access model type specific properties
if(state.item.XYZ) {
// some specific styling based upon values of the model (think of ranges for example)
}
}) { // opens the context for declaring the individual columns
column {
// and so on, Details in [ColumnContext]
}
}Inside of the `columns` context, only arbitrary amount of `column`s can be defined, but no other aspect!
See also
Constructors
Types
This context class manages the configuration and defines the DSL for exactly one column.
Functions
This context function opens the ColumnContext for configuring one column of the table.