NoRedInk/noredink-ui/7.8.0

NOTE: the latest version is 35.9.3

Nri.Ui.SortableTable.V1

type Column id entry msg
type alias Config id entry msg =
{ updateMsg : State id -> msg
, columns : List (Column id entry msg)
}
type alias Sorter a =
SortDirection -> a -> a -> Order
type alias State id =
{ column : id
, sortDirection : SortDirection
}
init : id -> State id
initDescending : id -> State id
{ id : id
, header : Html msg
, view : entry -> Html msg
, sorter : Sorter entry
, width : Int
}
-> Column id entry msg
{ id : id
, header : String
, value : entry -> String
, width : Int
}
-> Column id entry msg
view : Config id entry msg -> State id -> List entry -> Html msg
viewLoading : Config id entry msg -> State id -> Html msg
invariantSort : (entry -> comparable) -> Sorter entry

Create a sorter function that always orders the entries in the same order. For example, this is useful when we want to resolve ties and sort the tied entries by name, no matter of the sort direction set on the table.

simpleSort : (entry -> comparable) -> Sorter entry

Create a simple sorter function that orders entries by mapping a function over the collection. It will also reverse it when the sort direction is descending.

combineSorters : List (Sorter entry) -> Sorter entry

Modules