Mercurial > urweb
comparison demo/more/grid1.ur @ 931:be6585b4058b
Have nullable columns working with Dbgrid
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 13 Sep 2009 12:00:34 -0400 |
parents | 51bc7681c47e |
children | 0a156bbd205f |
comparison
equal
deleted
inserted
replaced
930:51bc7681c47e | 931:be6585b4058b |
---|---|
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, E : option int} | 7 table t : {Id : int, A : int, B : string, C : bool, D : int, E : option int, F : 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 |
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 = _}, | 26 Inj = _}, |
27 E = {New = return None, | 27 E = {New = return None, |
28 Inj = _}, | |
29 F = {New = return None, | |
28 Inj = _}} | 30 Inj = _}} |
29 | 31 |
30 structure F = Direct.Foreign(struct | 32 structure F = Direct.Foreign(struct |
31 con nm = #Id | 33 con nm = #Id |
32 val tab = t1 | 34 val tab = t1 |
33 fun render r = r.A | 35 fun render r = r.A |
34 end) | 36 end) |
35 | 37 |
36 val cols = {Id = Direct.readOnly [#Id] ! "Id" Direct.int, | 38 val cols = {Id = Direct.readOnly [#Id] ! "Id" Direct.int, |
37 A = Direct.editable [#A] ! "A" Direct.int, | 39 (*A = Direct.editable [#A] ! "A" Direct.int, |
38 B = Direct.editable [#B] ! "B" Direct.string, | 40 B = Direct.editable [#B] ! "B" Direct.string, |
39 C = Direct.editable [#C] ! "C" Direct.bool(*, | 41 C = Direct.editable [#C] ! "C" Direct.bool, |
40 D = Direct.editable [#D] ! "D" F.meta, | 42 D = Direct.editable [#D] ! "D" F.meta,*) |
41 E = Direct.editable [#E] ! "E" (Direct.nullable Direct.int), | 43 E = Direct.editable [#E] ! "E" (Direct.nullable Direct.int), |
44 F = Direct.editable [#F] ! "F" (Direct.nullable F.meta)(*, | |
42 DA = computed "2A" (fn r => 2 * r.A), | 45 DA = computed "2A" (fn r => 2 * r.A), |
43 Link = computedHtml "Link" (fn r => <xml><a link={page (r.A, r.B)}>Go</a></xml>)*)} | 46 Link = computedHtml "Link" (fn r => <xml><a link={page (r.A, r.B)}>Go</a></xml>)*)} |
44 end) | 47 end) |
45 | 48 |
46 fun main () = | 49 fun main () = |