comparison demo/more/grid1.ur @ 930:51bc7681c47e

Nullable columns *might* be working, but too much JS is generated for the page to load in finite time
author Adam Chlipala <adamc@hcoop.net>
date Sat, 12 Sep 2009 15:08:16 -0400
parents 0a91c6ee7eec
children be6585b4058b
comparison
equal deleted inserted replaced
929:095df8f710e0 930:51bc7681c47e
2 2
3 table t1 : {Id : int, A : string} 3 table t1 : {Id : int, A : string}
4 PRIMARY KEY Id 4 PRIMARY KEY Id
5 5
6 sequence s 6 sequence s
7 table t : {Id : int, A : int, B : string, C : bool, D : int} 7 table t : {Id : int, A : int, B : string, C : bool, D : int, E : option int}
8 PRIMARY KEY Id, 8 PRIMARY KEY Id,
9 CONSTRAINT Foreign FOREIGN KEY (D) REFERENCES t1(Id) ON DELETE CASCADE 9 CONSTRAINT Foreign FOREIGN KEY (D) REFERENCES t1(Id) ON DELETE CASCADE
10 10
11 fun page (n, s) = return <xml>A = {[n]}, B = {[s]}</xml> 11 (*fun page (n, s) = return <xml>A = {[n]}, B = {[s]}</xml>*)
12 12
13 open Make(struct 13 open Make(struct
14 val tab = t 14 val tab = t
15 con key = [Id = _] 15 con key = [Id = _]
16 16
21 B = {New = return "", 21 B = {New = return "",
22 Inj = _}, 22 Inj = _},
23 C = {New = return False, 23 C = {New = return False,
24 Inj = _}, 24 Inj = _},
25 D = {New = return 0, 25 D = {New = return 0,
26 Inj = _},
27 E = {New = return None,
26 Inj = _}} 28 Inj = _}}
27 29
28 structure F = Direct.Foreign(struct 30 structure F = Direct.Foreign(struct
29 con nm = #Id 31 con nm = #Id
30 val tab = t1 32 val tab = t1
32 end) 34 end)
33 35
34 val cols = {Id = Direct.readOnly [#Id] ! "Id" Direct.int, 36 val cols = {Id = Direct.readOnly [#Id] ! "Id" Direct.int,
35 A = Direct.editable [#A] ! "A" Direct.int, 37 A = Direct.editable [#A] ! "A" Direct.int,
36 B = Direct.editable [#B] ! "B" Direct.string, 38 B = Direct.editable [#B] ! "B" Direct.string,
37 C = Direct.editable [#C] ! "C" Direct.bool, 39 C = Direct.editable [#C] ! "C" Direct.bool(*,
38 D = Direct.editable [#D] ! "D" F.meta, 40 D = Direct.editable [#D] ! "D" F.meta,
41 E = Direct.editable [#E] ! "E" (Direct.nullable Direct.int),
39 DA = computed "2A" (fn r => 2 * r.A), 42 DA = computed "2A" (fn r => 2 * r.A),
40 Link = computedHtml "Link" (fn r => <xml><a link={page (r.A, r.B)}>Go</a></xml>)} 43 Link = computedHtml "Link" (fn r => <xml><a link={page (r.A, r.B)}>Go</a></xml>)*)}
41 end) 44 end)
42 45
43 fun main () = 46 fun main () =
44 grid <- grid; 47 grid <- grid;
45 return <xml> 48 return <xml>