mkDataTable :: (hdr -> Element -> UI Element) -> (row -> Int -> Element -> UI Element) -> [hdr] -> [row] -> UI DataTable
mkDataTable mkHdr mkEl hs rs = do
  t <- UI.table ##
    [ set class_ ["display"]
    ] #+
    [ thead #+
      [ UI.tr #+
        [ UI.th >>= mkHdr h
        | h <- hs
        ]
      ]
    , tbody #+
      [ UI.tr #+
        [ UI.td >>= mkEl r i
        | i <- iota $ length hs
        ]
      | r <- rs
      ]
    ]
  (r,e,h) <- newRefE =<< emptyJSObject
  b <- stepper False (True <$ e)
  i <- identify t
  initDataTable i h
  return $ DataTable t i r (() <$ e) b
mkDataTable :: (hdr -> Element -> UI Element) -> (row -> Int -> Element -> UI Element) -> [hdr] -> [row] -> UI DataTable
mkDataTable mkHdr mkEl hs rs = do
  t <- UI.table ##
    [ set class_ ["display"]
    ] #+
    [ thead #+
      [ UI.tr #+
        [ UI.th >>= mkHdr h
        | h <- hs
        ]
      ]
    , tbody #+
      [ UI.tr #+
        [ UI.td >>= mkEl r i
        | i <- iota $ length hs
        ]
      | r <- rs
      ]
    ]
  (r,e,h) <- newRefE =<< emptyJSObject
  b <- stepper False (True <$ e)
  i <- identify t
  initDataTable i h
  return $ DataTable t i r (() <$ e) b
mkDataTable mkHdr mkEl hs rs = do
  t <- UI.table ##
    [ set class_ ["display"]
    ] #+
    [ thead #+
      [ UI.tr #+
        [ UI.th >>= mkHdr h
        | h <- hs
        ]
      ]
    , tbody #+
      [ UI.tr #+
        [ UI.td >>= mkEl r i
        | i <- iota $ length hs
        ]
      | r <- rs
      ]
    ]
  (r,e,h) <- newRefE =<< emptyJSObject
  b <- stepper False (True <$ e)
  i <- identify t
  initDataTable i h
  return $ DataTable t i r (() <$ e) b