adamc@915: open Dbgrid
adamc@915:
adamc@915: table t1 : {Id : int, A : string}
adamc@915: PRIMARY KEY Id
adamc@915:
adamc@915: sequence s
adamc@915: table t : {Id : int, A : int, B : string, C : bool, D : int}
adamc@915: PRIMARY KEY Id,
adamc@915: CONSTRAINT Foreign FOREIGN KEY (D) REFERENCES t1(Id) ON DELETE CASCADE
adamc@915:
adamc@915: fun page (n, s) = return A = {[n]}, B = {[s]}
adamc@915:
adamc@915: open Make(struct
adamc@915: val tab = t
adamc@915: con key = [Id = _]
adamc@915:
adamc@915: val raw = {Id = {New = nextval s,
adamc@915: Inj = _},
adamc@915: A = {New = return 0,
adamc@915: Inj = _},
adamc@915: B = {New = return "",
adamc@915: Inj = _},
adamc@915: C = {New = return False,
adamc@915: Inj = _},
adamc@915: D = {New = return 0,
adamc@915: Inj = _}}
adamc@915:
adamc@915: structure F = Direct.Foreign(struct
adamc@915: con nm = #Id
adamc@915: val tab = t1
adamc@915: fun render r = r.A
adamc@915: end)
adamc@915:
adamc@915: val cols = {Id = Direct.readOnly [#Id] ! "Id" Direct.int,
adamc@915: A = Direct.editable [#A] ! "A" Direct.int,
adamc@915: B = Direct.editable [#B] ! "B" Direct.string,
adamc@915: C = Direct.editable [#C] ! "C" Direct.bool,
adamc@915: D = Direct.editable [#D] ! "D" F.meta,
adamc@915: DA = computed "2A" (fn r => 2 * r.A),
adamc@915: Link = computedHtml "Link" (fn r => Go)}
adamc@915: end)
adamc@915:
adamc@915: fun main () =
adamc@915: grid <- grid;
adamc@915: return
adamc@915:
adamc@923:
adamc@915:
adamc@915:
adamc@915: {render grid}
adamc@915:
adamc@915: