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@931: table t : {Id : int, A : int, B : string, C : bool, D : int, E : option int, F : option int} adamc@915: PRIMARY KEY Id, adamc@915: CONSTRAINT Foreign FOREIGN KEY (D) REFERENCES t1(Id) ON DELETE CASCADE adamc@915: adamc@932: 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@930: Inj = _}, adamc@930: E = {New = return None, adamc@931: Inj = _}, adamc@931: F = {New = return None, 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@932: A = Direct.editable [#A] ! "A" Direct.int, adamc@915: B = Direct.editable [#B] ! "B" Direct.string, adamc@931: C = Direct.editable [#C] ! "C" Direct.bool, adamc@932: D = Direct.editable [#D] ! "D" F.meta, adamc@930: E = Direct.editable [#E] ! "E" (Direct.nullable Direct.int), adamc@932: F = Direct.editable [#F] ! "F" (Direct.nullable F.meta), adamc@915: DA = computed "2A" (fn r => 2 * r.A), adamc@932: Link = computedHtml "Link" (fn r => Go)} adamc@935: adamc@937: val aggregates = {Dummy1 = {Initial = (), adamc@937: Step = fn _ _ => (), adamc@937: Display = fn _ => }, adamc@937: Sum = {Initial = 0, adamc@937: Step = fn r n => r.A + n, adamc@937: Display = txt}, adamc@937: Dummy2 = {Initial = (), adamc@937: Step = fn _ _ => (), adamc@940: Display = fn _ => }, adamc@937: And = {Initial = True, adamc@937: Step = fn r b => r.C && b, adamc@937: Display = txt}} adamc@915: end) adamc@915: adamc@915: fun main () = adamc@915: grid <- grid; adamc@940: set (showSelection grid) True; adamc@915: return adamc@915: adamc@923: adamc@915: adamc@915: adamc@915: {render grid} adamc@940:
adamc@941: Show selection
adamc@940: Selection: {[r.Id]}; ) ls)}/> adamc@915: adamc@915: