From 3f4d0fb5cd8c5f31b419e7b14f3c25c24bd7eec4 Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Sun, 17 Sep 2017 08:55:59 -0400 Subject: [PATCH] allow a table footer to be passed to cappedResizable --- reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs index e3e5188..0a88c3f 100644 --- a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs +++ b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs @@ -238,20 +238,24 @@ capped tableAttrs headAttrs bodyAttrs trAttrs fascia cornice collection = b <- body bodyAttrs trAttrs (E.discard cornice) collection return (h `mappend` b) +-- | This is useful when you want to be able to toggle the visibility +-- of columns after the table has been built. cappedResizable :: (DomBuilder t m, PostBuild t m, MonadHold t m, Foldable f, Monoid e) => Map Text Text -- ^ @\@ tag attributes -> Map Text Text -- ^ @\@ tag attributes -> Map Text Text -- ^ @\@ tag attributes + -> m () -- ^ Content beneath @\@. Should either be empty or a @\@. -> (a -> Map Text Text) -- ^ @\@ tag attributes -> Fascia p (Map Text Text) -- ^ Attributes for @\@ elements in the @\@ -> Cornice (Resizable t Headed) p a (Cell t m e) -- ^ Data encoding strategy -> f a -- ^ Collection of data -> m e -cappedResizable tableAttrs headAttrs bodyAttrs trAttrs fascia cornice collection = do +cappedResizable tableAttrs headAttrs bodyAttrs beneathBody trAttrs fascia cornice collection = do elAttr "table" tableAttrs $ do h <- encodeCorniceResizableHead headAttrs fascia (dynamicAnnotate cornice) b <- bodyResizable bodyAttrs trAttrs (E.discard cornice) collection + beneathBody return (h `mappend` b) dynamicAnnotate :: Reflex t