@@ -17,7 +17,7 @@ import GHCJS.DOM.Element
1717virtualListWithSelection :: forall t m k v. (MonadWidget t m, Ord k)
1818 => Int -- ^ The height of the visible region in pixels
1919 -> Int -- ^ The height of each row in pixels
20− -> Int -- ^ The total number of items
20+ -> Dynamic t Int -- ^ The total number of items
2121 -> Int -- ^ The index of the row to scroll to on initialization
2222 -> Event t Int -- ^ An 'Event' containing a row index. Used to scroll to the given index.
2323 -> String -- ^ The element tag for the list
@@ -28,10 +28,10 @@ virtualListWithSelection :: forall t m k v. (MonadWidget t m, Ord k)
2828 -> Dynamic t (Map k v) -- ^ The 'Map' of items
2929 -> m (Dynamic t (Int, Int), Event t k) -- ^ A tuple containing: a 'Dynamic' of the index (based on the current scroll position) and number of items currently being rendered, and an 'Event' of the selected key
3030virtualListWithSelection heightPx rowPx maxIndex i0 setI listTag listAttrs rowTag rowAttrs itemBuilder items = do
31− let totalHeightStyle = toHeightStyle $ rowPx * maxIndex
31+ totalHeightStyle <- mapDyn (toHeightStyle . (*) rowPx) maxIndex
3232 rec (container, itemList) <- elAttr "div" outerStyle $ elAttr' "div" containerStyle $ do
3333 currentTop <- mapDyn (listWrapperStyle . fst) window
34− (_, lis) <- elAttr "div" totalHeightStyle $ tagWrapper listTag listAttrs currentTop $ listWithKey itemsInWindow $ \k v -> do
34+ (_, lis) <- elDynAttr "div" totalHeightStyle $ tagWrapper listTag listAttrs currentTop $ listWithKey itemsInWindow $ \k v -> do
3535 (li,_) <- tagWrapper rowTag rowAttrs (constDyn $ toHeightStyle rowPx) $ itemBuilder k v
3636 return $ fmap (const k) (_el_clicked li)
3737 return lis