diff options
author | Joris | 2018-10-30 18:04:58 +0100 |
---|---|---|
committer | Joris | 2018-10-30 18:04:58 +0100 |
commit | 50fb8fa48d1c4881da20b4ecf6d68a772301e713 (patch) | |
tree | 99c30c644d40664a9a7bb4a27e838d7cccda7a5f /client/src/Component/Select.hs | |
parent | 40b4994797a797b1fa86cafda789a5c488730c6d (diff) |
Update table when adding or removing a payment
Diffstat (limited to 'client/src/Component/Select.hs')
-rw-r--r-- | client/src/Component/Select.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/Component/Select.hs b/client/src/Component/Select.hs index 17a4958..7cb6726 100644 --- a/client/src/Component/Select.hs +++ b/client/src/Component/Select.hs @@ -6,13 +6,14 @@ module Component.Select import Data.Map (Map) import Data.Text (Text) -import Reflex.Dom (Dynamic, MonadWidget, Reflex) +import Reflex.Dom (Dynamic, Event, MonadWidget, Reflex) import qualified Reflex.Dom as R data (Reflex t) => SelectIn t a = SelectIn { _selectIn_label :: Text , _selectIn_initialValue :: a , _selectIn_values :: Dynamic t (Map a Text) + , _selectIn_reset :: Event t () } data SelectOut t a = SelectOut @@ -24,8 +25,13 @@ select selectIn = R.divClass "selectInput" $ do R.el "label" $ R.text (_selectIn_label selectIn) + let initialValue = _selectIn_initialValue selectIn + value <- R._dropdown_value <$> - R.dropdown (_selectIn_initialValue selectIn) (_selectIn_values selectIn) R.def + R.dropdown + initialValue + (_selectIn_values selectIn) + (R.def { R._dropdownConfig_setValue = fmap (const initialValue) (_selectIn_reset selectIn) }) return SelectOut { _selectOut_value = value |