comparison demo/more/grid.ur @ 1172:ad15700272f6

Changing foldRX to mapX
author Adam Chlipala <adamc@hcoop.net>
date Sun, 28 Feb 2010 13:06:10 -0500
parents 8d3aa6c7cee0
children f0afe61a6f8b
comparison
equal deleted inserted replaced
1171:7a2a7a8f9cab 1172:ad15700272f6
121 121
122 fun render (grid : grid) = <xml> 122 fun render (grid : grid) = <xml>
123 <table class={tabl}> 123 <table class={tabl}>
124 <tr class={tr}> 124 <tr class={tr}>
125 <th/> <th/> <th><button value="No sort" onclick={set grid.Sort None}/></th> 125 <th/> <th/> <th><button value="No sort" onclick={set grid.Sort None}/></th>
126 {@foldRX2 [fst3] [colMeta M.row] [_] 126 {@mapX2 [fst3] [colMeta M.row] [_]
127 (fn [nm :: Name] [p :: (Type * Type * Type)] [rest :: {(Type * Type * Type)}] [[nm] ~ rest] 127 (fn [nm :: Name] [p :: (Type * Type * Type)] [rest :: {(Type * Type * Type)}] [[nm] ~ rest]
128 data (meta : colMeta M.row p) => 128 data (meta : colMeta M.row p) =>
129 <xml><th class={th}> 129 <xml><th class={th}>
130 {case (meta.Handlers data).Sort of 130 {case (meta.Handlers data).Sort of
131 None => txt (meta.Handlers data).Header 131 None => txt (meta.Handlers data).Header
206 else 206 else
207 <xml><button value="Delete" onclick={delete}/></xml>)}/> 207 <xml><button value="Delete" onclick={delete}/></xml>)}/>
208 </td> 208 </td>
209 209
210 <dyn signal={cols <- signal colsS; 210 <dyn signal={cols <- signal colsS;
211 return (@foldRX3 [fst3] [colMeta M.row] [snd3] [_] 211 return (@mapX3 [fst3] [colMeta M.row] [snd3] [_]
212 (fn [nm :: Name] [t :: (Type * Type * Type)] 212 (fn [nm :: Name] [t :: (Type * Type * Type)]
213 [rest :: {(Type * Type * Type)}] 213 [rest :: {(Type * Type * Type)}]
214 [[nm] ~ rest] data meta v => 214 [[nm] ~ rest] data meta v =>
215 <xml><td class={td}> 215 <xml><td class={td}>
216 <dyn signal={b <- signal ud; 216 <dyn signal={b <- signal ud;
258 (@mp [aggregateMeta M.row] [id] 258 (@mp [aggregateMeta M.row] [id]
259 (fn [t] meta => meta.Initial) 259 (fn [t] meta => meta.Initial)
260 M.aggFolder M.aggregates) grid.Rows; 260 M.aggFolder M.aggregates) grid.Rows;
261 return <xml><tr> 261 return <xml><tr>
262 <th colspan={3}>Aggregates</th> 262 <th colspan={3}>Aggregates</th>
263 {@foldRX2 [aggregateMeta M.row] [id] [_] 263 {@mapX2 [aggregateMeta M.row] [id] [_]
264 (fn [nm :: Name] [t :: Type] [rest :: {Type}] [[nm] ~ rest] meta acc => 264 (fn [nm :: Name] [t :: Type] [rest :: {Type}] [[nm] ~ rest] meta acc =>
265 <xml><td class={agg}>{meta.Display acc}</td></xml>) 265 <xml><td class={agg}>{meta.Display acc}</td></xml>)
266 M.aggFolder M.aggregates rows} 266 M.aggFolder M.aggregates rows}
267 </tr></xml>}/> 267 </tr></xml>}/>
268 268
269 <tr><th colspan={3}>Filters</th> 269 <tr><th colspan={3}>Filters</th>
270 {@foldRX3 [colMeta M.row] [fst3] [thd3] [_] 270 {@mapX3 [colMeta M.row] [fst3] [thd3] [_]
271 (fn [nm :: Name] [p :: (Type * Type * Type)] [rest :: {(Type * Type * Type)}] [[nm] ~ rest] 271 (fn [nm :: Name] [p :: (Type * Type * Type)] [rest :: {(Type * Type * Type)}] [[nm] ~ rest]
272 meta state filter => <xml><td>{(meta.Handlers state).DisplayFilter filter}</td></xml>) 272 meta state filter => <xml><td>{(meta.Handlers state).DisplayFilter filter}</td></xml>)
273 M.folder M.cols grid.Cols grid.Filters} 273 M.folder M.cols grid.Cols grid.Filters}
274 </tr> 274 </tr>
275 </table> 275 </table>