Mercurial > urweb
diff demo/more/grid.ur @ 951:103ac1792c41
Make filter argument to render, not create
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Sep 2009 14:27:00 -0400 |
parents | da3ec6014d2f |
children | 07569af40069 |
line wrap: on
line diff
--- a/demo/more/grid.ur Thu Sep 17 13:44:08 2009 -0400 +++ b/demo/more/grid.ur Thu Sep 17 14:27:00 2009 -0400 @@ -80,19 +80,13 @@ (meta.Handlers state).CreateFilter) [_] M.folder M.cols cols; - rows <- Dlist.create {Filter = fn all => - row <- signal all.Row; - foldR3 [colMeta M.row] [fst3] [thd3] [fn _ => M.row -> signal bool] - (fn [nm :: Name] [p :: (Type * Type * Type)] - [rest :: {(Type * Type * Type)}] [[nm] ~ rest] - meta state filter combinedFilter row => - previous <- combinedFilter row; - this <- (meta.Handlers state).Filter filter row; - return (previous && this)) - (fn _ => return True) - [_] M.folder M.cols cols filters row}; + rows <- Dlist.create; sel <- source False; - return {Cols = cols, Rows = rows, Selection = sel, Filters = filters} + + return {Cols = cols, + Rows = rows, + Selection = sel, + Filters = filters} fun sync {Cols = cols, Rows = rows, ...} = Dlist.clear rows; @@ -207,7 +201,19 @@ </td></xml>) [_] M.folder grid.Cols M.cols cols)}/> </tr></xml> - end) grid.Rows} + end) + {Filter = fn all => + row <- signal all.Row; + foldR3 [colMeta M.row] [fst3] [thd3] [fn _ => M.row -> signal bool] + (fn [nm :: Name] [p :: (Type * Type * Type)] + [rest :: {(Type * Type * Type)}] [[nm] ~ rest] + meta state filter combinedFilter row => + previous <- combinedFilter row; + this <- (meta.Handlers state).Filter filter row; + return (previous && this)) + (fn _ => return True) + [_] M.folder M.cols grid.Cols grid.Filters row} + grid.Rows} <dyn signal={rows <- Dlist.foldl (fn row => Monad.mapR2 [aggregateMeta M.row] [id] [id] (fn [nm :: Name] [t :: Type] meta acc =>