diff options
author | 2009-09-19 13:32:33 -0400 | |
---|---|---|
committer | 2009-09-19 13:32:33 -0400 | |
commit | 11fd1db04f22101a5a0fa8e1d5b57126e75f6eb5 (patch) | |
tree | f50a6fffa9a2e6aaacfe70b509015a14b90a0a16 /demo/more/grid.ur | |
parent | e6166ff9bc4f189cadaf235672543890ef922d11 (diff) |
Grid sorting working
Diffstat (limited to 'demo/more/grid.ur')
-rw-r--r-- | demo/more/grid.ur | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/demo/more/grid.ur b/demo/more/grid.ur index 829fead0..7cd16d72 100644 --- a/demo/more/grid.ur +++ b/demo/more/grid.ur @@ -7,7 +7,8 @@ con colMeta' = fn (row :: Type) (input :: Type) (filter :: Type) => Validate : input -> signal bool, CreateFilter : transaction filter, DisplayFilter : filter -> xbody, - Filter : filter -> row -> signal bool} + Filter : filter -> row -> signal bool, + Sort : option (row -> row -> bool)} con colMeta = fn (row :: Type) (global_input_filter :: (Type * Type * Type)) => {Initialize : transaction global_input_filter.1, @@ -101,14 +102,19 @@ functor Make(M : sig rs <- List.mapM (newRow cols) init; Dlist.replace rows rs - fun render grid = <xml> + fun render (grid : grid) = <xml> <table class={tabl}> <tr class={tr}> - <th/> <th/> <th/> + <th/> <th/> <th><button value="No sort" onclick={set grid.Sort None}/></th> {foldRX2 [fst3] [colMeta M.row] [_] (fn [nm :: Name] [p :: (Type * Type * Type)] [rest :: {(Type * Type * Type)}] [[nm] ~ rest] data (meta : colMeta M.row p) => - <xml><th class={th}>{[(meta.Handlers data).Header]}</th></xml>) + <xml><th class={th}> + {case (meta.Handlers data).Sort of + None => txt (meta.Handlers data).Header + | sort => <xml><button value={(meta.Handlers data).Header} + onclick={set grid.Sort sort}/></xml>} + </th></xml>) [_] M.folder grid.Cols M.cols} </tr> |