primait/pyxis-components/3.3.1

NOTE: the latest version is 9.0.3

Prima.Pyxis.Table

Creates a customizable Table component by using predefined Html syntax.

Configuration

type Config msg

Represents the static configuration of the component.

Represents the table skin.

type State

Represents the basic state of the component.

type Row msg

Represents a Row which contains a list of Columns.

type Column msg

Represents a Column which can manage a specific kind of data.

type alias ColSpan =
Int

Represents the colSpan of a column. Alias for Integer.

Configuration Helpers

config : TableType -> List (Header msg) -> List (Row msg) -> Bool -> Config msg

Returns the config of the component.

...


type Msg =
    SortBy String
...


myTableConfig : Table.Config
myTableConfig =
    let
        headers : List (Table.Header Msg)
        headers =
            List.map (\content -> Table.header (String.toLower content) content SortBy) [ "Country", "Capital city" ]


        rows : List (Table.Row Msg)
        rows =
            List.map (Table.row << List.map Table.columnString ) [ ["Italy", "Rome"], ["France", "Paris"], ["U.K.", "London"] ]


        alternateRows =
            True


    in
    Table.config Table.defaultType headers rows alternateRows


...

Creates an initial State with no sort applied.

Represents the Default table skin.

Represents the Alternative table skin.

Configuration for Rows & Headers

row : List (Column msg) -> Row msg

Creates a Row

myRow : List (Column Msg) -> Table.Row Msg
myRow columns =
    Table.row columns

Configuration for Columns

columnFloat : ColSpan -> Float -> Column msg

Creates a Column which content is Float primitive.

columnHtml : ColSpan -> List (Html msg) -> Column msg

Creates a Column which content is Html.

columnInteger : ColSpan -> Int -> Column msg

Creates a Column which content is Integer primitive.

columnString : ColSpan -> String -> Column msg

Creates a Column which content is String primitive.

Helpers

sortByAsc : Slug -> State -> State

Sorts the column defined by Slug in Asc order.

sortByDesc : Slug -> State -> State

Sorts the column defined by Slug in Desc order.

Unsets sorting for any column.

Render

render : State -> Config msg -> Html msg

Renders a Table by receiving a State and a Config