comparison demo/more/dbgrid.ur @ 946:2412cb10c97c

Filters displaying properly
author Adam Chlipala <adamc@hcoop.net>
date Tue, 15 Sep 2009 16:27:24 -0400
parents da3ec6014d2f
children 8c37699de273
comparison
equal deleted inserted replaced
945:7710f65935b6 946:2412cb10c97c
107 Edit = m.Edit, 107 Edit = m.Edit,
108 Initialize = fn v => source (m.Initialize v), 108 Initialize = fn v => source (m.Initialize v),
109 Parse = fn s => v <- signal s; return (m.Parse v), 109 Parse = fn s => v <- signal s; return (m.Parse v),
110 CreateFilter = source m.CreateFilter, 110 CreateFilter = source m.CreateFilter,
111 DisplayFilter = m.DisplayFilter, 111 DisplayFilter = m.DisplayFilter,
112 Filter = fn f v => f <- signal f; return (m.Filter f v)}, 112 Filter = fn f v => f <- signal f;
113 return (if m.FilterIsNull f then
114 True
115 else
116 m.Filter f v)},
113 {Display = fn s => <xml><dyn signal={v <- signal s; return (m.Display v)}/></xml>, 117 {Display = fn s => <xml><dyn signal={v <- signal s; return (m.Display v)}/></xml>,
114 Edit = m.Edit, 118 Edit = m.Edit,
115 Initialize = fn v => source (case v of 119 Initialize = fn v => source (case v of
116 None => m.InitializeNull 120 None => m.InitializeNull
117 | Some v => m.Initialize v), 121 | Some v => m.Initialize v),
124 | Some v' => Some (Some v')), 128 | Some v' => Some (Some v')),
125 CreateFilter = source m.CreateFilter, 129 CreateFilter = source m.CreateFilter,
126 DisplayFilter = m.DisplayFilter, 130 DisplayFilter = m.DisplayFilter,
127 Filter = fn f v => f <- signal f; 131 Filter = fn f v => f <- signal f;
128 return (if m.FilterIsNull f then 132 return (if m.FilterIsNull f then
129 Option.isNone v 133 True
130 else 134 else
131 case v of 135 case v of
132 None => False 136 None => False
133 | Some v => m.Filter f v) : signal bool})} 137 | Some v => m.Filter f v) : signal bool})}
134 138
141 type intGlobal = unit 145 type intGlobal = unit
142 type intInput = basicState string 146 type intInput = basicState string
143 type intFilter = basicFilter string 147 type intFilter = basicFilter string
144 val int : meta (intGlobal, int, intInput, intFilter) = 148 val int : meta (intGlobal, int, intInput, intFilter) =
145 basic {Display = fn s => <xml>{[s]}</xml>, 149 basic {Display = fn s => <xml>{[s]}</xml>,
146 Edit = fn s => <xml><ctextbox source={s}/></xml>, 150 Edit = fn s => <xml><ctextbox size={5} source={s}/></xml>,
147 Initialize = fn n => show n, 151 Initialize = fn n => show n,
148 InitializeNull = "", 152 InitializeNull = "",
149 IsNull = eq "", 153 IsNull = eq "",
150 Parse = fn v => read v, 154 Parse = fn v => read v,
151 CreateFilter = "", 155 CreateFilter = "",
152 DisplayFilter = fn s => <xml><ctextbox source={s}/></xml> : xbody, 156 DisplayFilter = fn s => <xml><ctextbox size={5} source={s}/></xml> : xbody,
153 Filter = fn s n => 157 Filter = fn s n =>
154 case read s of 158 case read s of
155 None => True 159 None => True
156 | Some n' => n' = n, 160 | Some n' => n' = n,
157 FilterIsNull = eq ""} 161 FilterIsNull = eq ""}