hide inactive rows

This commit is contained in:
Andrew Martin 2017-09-28 17:05:49 -04:00
parent 8c0faf9ae2
commit eeaa05d2a2

View File

@ -731,7 +731,7 @@ tableBodyExpandable colCount renderExpansion bodyAttrs trAttrs col collection a0
let attrs = trAttrs a
expanded <- elDynAttr "tr" attrs (rowSizableReified (return False) (zipDynWith (||)) col a)
visibleVal <- gateDynamic expanded a0 a
elDynAttr "tr" attrs $ do
elDynAttr "tr" (zipDynWith insertVisibilityAttr expanded attrs) $ do
-- TODO: possibly provide a way to customize these attributes
let expansionTdAttrs = pure M.empty
elDynAttr "td" (zipDynWith insertSizeAttr colCount expansionTdAttrs) (renderExpansion visibleVal)
@ -783,6 +783,11 @@ rowSizable (E.Colonnade v) a = V.foldM (\m oc -> do
return (mappend m e)
) mempty v
insertVisibilityAttr :: Bool -> Map Text Text -> Map Text Text
insertVisibilityAttr b m = case b of
False -> M.insertWith T.append "style" "display:none;" m
True -> m
insertSizeAttr :: Int -> Map Text Text -> Map Text Text
insertSizeAttr i m
| i < 1 = M.insertWith T.append "style" "display:none;" m