Mercurial > urweb
comparison demo/batch.ur @ 908:ed06e25c70ef
Convert to requiring explicit 'rpc' marker
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 22 Aug 2009 12:55:18 -0400 |
parents | a44daa674810 |
children | e6bc6bbd7a32 |
comparison
equal
deleted
inserted
replaced
907:5fe49effbc83 | 908:ed06e25c70ef |
---|---|
23 fun show' ls = | 23 fun show' ls = |
24 case ls of | 24 case ls of |
25 Nil => <xml/> | 25 Nil => <xml/> |
26 | Cons ((id, a), ls) => <xml> | 26 | Cons ((id, a), ls) => <xml> |
27 <tr><td>{[id]}</td> <td>{[a]}</td> {if withDel then | 27 <tr><td>{[id]}</td> <td>{[a]}</td> {if withDel then |
28 <xml><td><button value="Delete" onclick={del id}/></td></xml> | 28 <xml><td><button value="Delete" onclick={rpc (del id)}/> |
29 </td></xml> | |
29 else | 30 else |
30 <xml/>} </tr> | 31 <xml/>} </tr> |
31 {show' ls} | 32 {show' ls} |
32 </xml> | 33 </xml> |
33 in | 34 in |
53 set batched (Cons ((readError id, a), ls)) | 54 set batched (Cons ((readError id, a), ls)) |
54 | 55 |
55 fun exec () = | 56 fun exec () = |
56 ls <- get batched; | 57 ls <- get batched; |
57 | 58 |
58 doBatch ls; | 59 rpc (doBatch ls); |
59 set batched Nil | 60 set batched Nil |
60 in | 61 in |
61 return <xml><body> | 62 return <xml><body> |
62 <h2>Rows</h2> | 63 <h2>Rows</h2> |
63 | 64 |
64 {show True lss} | 65 {show True lss} |
65 | 66 |
66 <button value="Update" onclick={ls <- allRows (); set lss ls}/><br/> | 67 <button value="Update" onclick={ls <- rpc (allRows ()); set lss ls}/><br/> |
67 <br/> | 68 <br/> |
68 | 69 |
69 <h2>Batch new rows to add</h2> | 70 <h2>Batch new rows to add</h2> |
70 | 71 |
71 <table> | 72 <table> |