diff demo/more/grid.ur @ 960:6f34950825b6

Hopefully fixed Jscomp bug that was breaking Grid
author Adam Chlipala <adamc@hcoop.net>
date Sat, 19 Sep 2009 10:56:09 -0400
parents 3aaac251a5af
children 8c37699de273
line wrap: on
line diff
--- a/demo/more/grid.ur	Fri Sep 18 19:30:09 2009 -0400
+++ b/demo/more/grid.ur	Sat Sep 19 10:56:09 2009 -0400
@@ -57,7 +57,8 @@
                                      Updating : source bool,
                                      Selected : source bool},
                  Selection : source bool,
-                 Filters : $(map thd3 M.cols)}
+                 Filters : $(map thd3 M.cols),
+                 Sort : source (option (M.row -> M.row -> bool))}
 
     fun newRow cols row =
         rowS <- source row;
@@ -86,11 +87,13 @@
 
         rows <- Dlist.create;
         sel <- source False;
+        sort <- source None;
 
         return {Cols = cols,
                 Rows = rows,
                 Selection = sel,
-                Filters = filters}
+                Filters = filters,
+                Sort = sort}
 
     fun sync {Cols = cols, Rows = rows, ...} =
         Dlist.clear rows;
@@ -218,7 +221,10 @@
                                               return (previous && this))
                                           (fn _ => return True)
                                           [_] M.folder M.cols grid.Cols grid.Filters row,
-                       Sort = return (Some (fn _ _ => return True))}
+                       Sort = f <- signal grid.Sort;
+                              return (Option.mp (fn f r1 r2 => r1 <- signal r1.Row;
+                                                    r2 <- signal r2.Row;
+                                                    return (f r1 r2)) f)}
                       grid.Rows}
 
             <dyn signal={rows <- Dlist.foldl (fn row => Monad.mapR2 [aggregateMeta M.row] [id] [id]