This library displays a grid of data. It offers filtering, sorting, multiple selection, click event listener and customizable rendering of the lines, cells and columns.
A grid is defined using a Config
The list of data can be very long, thanks to the use of FabienHenon/elm-infinite-list-view under the hood.
The configuration for a column. The grid content is described using a list of ColumnConfigs.
idColumn =
{ properties =
{ id = "Id"
, order = Unsorted
, title = "Id"
, visible = True
, width = 50
}
, filters = IntFilter <| intFilter (\item -> item.id)
, filteringValue = Nothing
, renderer = viewInt (\item -> item.id)
, comparator = compareIntField (\item -> item.id)
}Compares two boolean. Use this function in a ColumnConfig to define how the values in a given column should be compared. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
comparator =
compareBoolField (\item -> item.even)Compares two floating point numbers. Use this function in a ColumnConfig to define how the values in a given column should be compared. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
comparator =
compareFloatField (\item -> item.value)Compares two integers. Use this function in a ColumnConfig to define how the values in a given column should be compared. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
comparator =
compareIntField (\item -> item.id)Compares two strings. Use this function in a ColumnConfig to define how the values in a given column should be compared. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
comparator =
compareStringField (\item -> item.name)Renders a cell containing a boolean value. Use this function in a ColumnConfig to define how the values in a given column should be rendered. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
renderer =
viewBool (\item -> item.even)Renders a cell containing a floating number. Use this function in a ColumnConfig to define how the values in a given column should be rendered. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
renderer =
viewFloat (\item -> item.value)Renders a cell containing an int value. Use this function in a ColumnConfig to define how the values in a given column should be rendered. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
renderer =
viewInt (\item -> item.id)Renders a progress bar in a a cell containing a integer. Use this function in a ColumnConfig to define how the values in a given column should be rendered. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
renderer =
viewProgressBar 8 (\item -> item.value)Renders a cell containing a string. Use this function in a ColumnConfig to define how the values in a given column should be rendered. The unique parameter to be provided is a lambda which returns the field to be displayed in this column.
renderer =
viewString (\item -> item.name)The grid model. You'll use it but should not have to access its fields, and definitely should not modify them directly
Initializes the grid model, according to the given grid configuration and content.
init : () -> ( Model, Cmd Msg )
init _ =
( { gridModel = Grid.init gridConfig items
}
, Cmd.none
)Msg(..) does not have any docs. The module's documentation names it in an @docs line, but the package does not expose it.#Docs for Sorting
Sorting(..) does not have any docs. The module's documentation names it in an @docs line, but the package does not expose it.
The configuration for the grid