xdelph / elm-slick-grid / Grid.Filters

Helper functions for filtering the grid content

Data type


type alias Item a =
{ a | selected : Basics.Bool
, index : Basics.Int 
}

The data to be displayed in the grid It must be records with at least two fields: selected et index

items =
    [ { index = 0
      , name = "item0"
      , selected = False
      }
    , { index = 1
      , name = "item1"
      , selected = False
      }
    ]

Helpers

boolFilter : (Item a -> Basics.Bool) -> TypedFilter a Basics.Bool

Filters booleans. The lambda function to be provided as a parameter returns the value of the field to be filtered.

filters =
    BoolFilter <| boolFilter (\item -> item.even)

floatFilter : (Item a -> Basics.Float) -> TypedFilter a Basics.Float

Filters floating point numbers. The lambda function to be provided as a parameter returns the value of the field to be filtered.

filters =
    FloatFilter <| floatFilter (\item -> item.value)

intFilter : (Item a -> Basics.Int) -> TypedFilter a Basics.Int

Filters integers. The lambda function to be provided as a parameter returns the value of the field to be filtered.

filters =
    IntFilter <| intFilter (\\item -> item.id)

stringFilter : (Item a -> String) -> TypedFilter a String

Filters strings. The lambda function to be provided as a parameter returns the value of the field to be filtered.

filters =
    StringFilter <| stringFilter (\item -> item.name)

Others

parseFilteringString : Maybe String -> Filter a -> Maybe (Item a -> Basics.Bool)

TODO some docs