From f62d10b75c9456c4a7287ed30818272fc79517e0 Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Fri, 15 Sep 2017 15:40:19 -0400 Subject: [PATCH] use display:none instead of setting colspan to 0 --- reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs index 6a48d94..e3e5188 100644 --- a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs +++ b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs @@ -144,7 +144,12 @@ bodyResizable bodyAttrs trAttrs colonnade collection = elAttr "tbody" bodyAttrs $ elAttr "tr" (trAttrs a) $ unWrappedApplicative $ E.rowMonoidalHeader colonnade (\(Resizable dynSize _) (Cell cattr content) -> - WrappedApplicative (elDynAttr "td" (zipDynWith (\i at -> M.insert "colspan" (T.pack (show i)) at) dynSize cattr) content)) a + WrappedApplicative (elDynAttr "td" (zipDynWith setColspanOrHide dynSize cattr) content)) a + +setColspanOrHide :: Int -> Map Text Text -> Map Text Text +setColspanOrHide i m + | i < 1 = M.insertWith T.append "style" "display:none;" m + | otherwise = M.insert "colspan" (T.pack (show i)) m static :: (DomBuilder t m, PostBuild t m, Foldable f, Foldable h, Monoid e) @@ -213,10 +218,7 @@ encodeCorniceResizableHead headAttrs fascia annCornice = thead :: WrappedApplicative m e thead = E.headersMonoidal (Just (fascia, addAttr)) [(th,id)] annCornice th :: Dynamic t Int -> Cell t m e -> WrappedApplicative m e - th size (Cell attrs contents) = WrappedApplicative (elDynAttr "th" (zipDynWith addColspan size attrs) contents) - where - addColspan :: Int -> Map Text Text -> Map Text Text - addColspan i = M.insert "colspan" (T.pack (show i)) + th size (Cell attrs contents) = WrappedApplicative (elDynAttr "th" (zipDynWith setColspanOrHide size attrs) contents) addAttr :: Map Text Text -> WrappedApplicative m b -> WrappedApplicative m b addAttr attrs = WrappedApplicative . elAttr "tr" attrs . unWrappedApplicative