Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A datagrid widget for the Monomer UI library.
Synopsis
- data HagridCfg s e
- data Column e a = Column {
- name :: Text
- widget :: ColumnWidget e a
- footerWidget :: ColumnFooterWidget e a
- align :: ColumnAlign
- sortKey :: ColumnSortKey a
- initialWidth :: Int
- minWidth :: Int
- paddingW :: Double
- paddingH :: Double
- resizeHandler :: Maybe (Int -> e)
- sortHandler :: Maybe (SortDirection -> e)
- data ColumnAlign
- data ColumnWidget e a
- = LabelWidget (Int -> a -> Text)
- | CustomWidget (forall s. WidgetModel s => Int -> a -> WidgetNode s e)
- data ColumnFooterWidget e a
- = NoFooterWidget
- | CustomFooterWidget (forall s. WidgetModel s => [(a, Int)] -> WidgetNode s e)
- data ColumnSortKey a
- data SortDirection
- type ScrollToRowCallback a = [(a, Int)] -> Maybe Int
- initialSort :: Int -> SortDirection -> HagridCfg s e
- hagrid :: forall a s e. (CompositeModel a, WidgetModel s, WidgetEvent e) => [Column e a] -> [a] -> WidgetNode s e
- hagrid_ :: forall a s e. (CompositeModel a, WidgetModel s, WidgetEvent e) => [HagridCfg s e] -> [Column e a] -> [a] -> WidgetNode s e
- textColumn :: Text -> (a -> Text) -> Column e a
- showOrdColumn :: (Show b, Ord b) => Text -> (a -> b) -> Column e a
- widgetColumn :: Text -> (forall s. Int -> a -> WidgetNode s e) -> Column e a
- scrollToRow :: forall s e sp ep a. (Typeable a, Typeable e) => WidgetKey -> ScrollToRowCallback a -> EventResponse s e sp ep
Types
Configuration options for Hagrid widgets.
A column definition.
Column | |
|
data ColumnAlign Source #
How to align the widget within each cell of a column.
Instances
Show ColumnAlign Source # | |
Defined in Monomer.Hagrid showsPrec :: Int -> ColumnAlign -> ShowS # show :: ColumnAlign -> String # showList :: [ColumnAlign] -> ShowS # | |
Eq ColumnAlign Source # | |
Defined in Monomer.Hagrid (==) :: ColumnAlign -> ColumnAlign -> Bool # (/=) :: ColumnAlign -> ColumnAlign -> Bool # |
data ColumnWidget e a Source #
How to create the widget that displays each cell in a column.
LabelWidget (Int -> a -> Text) | Create a label widget.. The function receives the original item index (i.e. not the index in the sorted list) and the item itself. |
CustomWidget (forall s. WidgetModel s => Int -> a -> WidgetNode s e) | Create a widget of arbitrary type. The function receives the original item index (i.e. not the index in the sorted list) and the item itself. |
data ColumnFooterWidget e a Source #
How to create the footer widget for a column.
NoFooterWidget | No footer widget for this column. |
CustomFooterWidget (forall s. WidgetModel s => [(a, Int)] -> WidgetNode s e) | Create a footer widget. The function receives the items in their current sort order, and also along with each item it's original (unsorted) index. |
data ColumnSortKey a Source #
Whether a column can be sorted by the user clicking the column header, and if so, how.
data SortDirection Source #
Whether a column is being sorted in ascending or descending order.
Instances
Show SortDirection Source # | |
Defined in Monomer.Hagrid showsPrec :: Int -> SortDirection -> ShowS # show :: SortDirection -> String # showList :: [SortDirection] -> ShowS # | |
Eq SortDirection Source # | |
Defined in Monomer.Hagrid (==) :: SortDirection -> SortDirection -> Bool # (/=) :: SortDirection -> SortDirection -> Bool # |
type ScrollToRowCallback a Source #
= [(a, Int)] | The items in the grid, in the originally provided order, along with each item's index in the current grid order. |
-> Maybe Int | The row to scroll to, as an index into the sorted items (e.g. 0 is always the first row
in the grid, regardless of the current order). |
Picks an item to scroll to, based on the sorted or original grid contents.
Configuration options
:: Int | The initial sort column (zero-indexed, out of bounds values will have no effect). |
-> SortDirection | The initial sort direction. |
-> HagridCfg s e |
Configures the initial sort column and direction.
Hagrid constructors
:: forall a s e. (CompositeModel a, WidgetModel s, WidgetEvent e) | |
=> [Column e a] | The definitions for each column in the grid. |
-> [a] | The items for each row in the grid. |
-> WidgetNode s e |
Creates a hagrid widget, using the default configuration.
:: forall a s e. (CompositeModel a, WidgetModel s, WidgetEvent e) | |
=> [HagridCfg s e] | |
-> [Column e a] | The definitions for each column in the grid. |
-> [a] | The items for each row in the grid. |
-> WidgetNode s e |
Creates a hagrid widget, using the given configuration.
Column Constructors
:: Text | Name of the column, to display in the header. |
-> (a -> Text) | Called with the item for each row to get the text to display for that row. |
-> Column e a |
Creates a column that displays a text value, and is sortable by the text.
:: (Show b, Ord b) | |
=> Text | Name of the column, to display in the header. |
-> (a -> b) | Called with the item for each row to get the value to display (via |
-> Column e a |
Creates a column that displays the result of calling
on a value, and is sortable by the value.show
:: Text | Name of the column, to display in the header. |
-> (forall s. Int -> a -> WidgetNode s e) | Called with the (original, not sorted) index and the item for each row to get the widget to display for that row. |
-> Column e a |
Creates a column that displays the a custom widget in each cell.
Messages
:: forall s e sp ep a. (Typeable a, Typeable e) | |
=> WidgetKey | The widget to target. |
-> ScrollToRowCallback a | Determines which row to scroll to. |
-> EventResponse s e sp ep |
Sends a message to the targeted hagrid
widget, that causes the
widget to scroll such that a specified row becomes visible.