Mercurial > urweb
annotate demo/more/grid0.ur @ 1073:b2311dfb3158
Initializers and setval
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 13 Dec 2009 14:20:41 -0500 |
parents | 8932f855fa85 |
children | f0afe61a6f8b |
rev | line source |
---|---|
adamc@1039 | 1 open Dbgrid |
adamc@1039 | 2 |
adamc@1039 | 3 sequence s |
adamc@1039 | 4 table t : {Id : int, A : int} |
adamc@1039 | 5 PRIMARY KEY Id |
adamc@1039 | 6 |
adamc@1039 | 7 open Make(struct |
adamc@1039 | 8 val tab = t |
adamc@1039 | 9 con key = [Id = _] |
adamc@1039 | 10 |
adamc@1039 | 11 val raw = {Id = {New = nextval s, |
adamc@1039 | 12 Inj = _}, |
adamc@1039 | 13 A = {New = return 0, |
adamc@1039 | 14 Inj = _}} |
adamc@1039 | 15 |
adamc@1039 | 16 val cols = {Id = Direct.readOnly [#Id] ! "Id" Direct.int, |
adamc@1039 | 17 A = Direct.editable [#A] ! "A" Direct.int} |
adamc@1039 | 18 |
adamc@1039 | 19 val aggregates = {} |
adamc@1039 | 20 |
adamc@1039 | 21 val pageLength = None |
adamc@1039 | 22 end) |
adamc@1039 | 23 |
adamc@1039 | 24 fun main () = |
adamc@1039 | 25 grid <- grid; |
adamc@1039 | 26 set (showSelection grid) True; |
adamc@1039 | 27 return <xml> |
adamc@1039 | 28 <head> |
adamc@1039 | 29 <link rel="stylesheet" type="text/css" href="../../grid.css"/> |
adamc@1039 | 30 </head> |
adamc@1039 | 31 <body onload={sync grid}> |
adamc@1039 | 32 {render grid} |
adamc@1039 | 33 </body> |
adamc@1039 | 34 </xml> |