152 datatype: "local", |
152 datatype: "local", |
153 datafields: [ |
153 datafields: [ |
154 { name: 'w_name', type: 'string' }, |
154 { name: 'w_name', type: 'string' }, |
155 { name: 'w_amount', type: 'float' }, |
155 { name: 'w_amount', type: 'float' }, |
156 { name: 'w_calcium', type: 'float' }, |
156 { name: 'w_calcium', type: 'float' }, |
157 { name: 'w_bicarbonate', type: 'float' }, |
|
158 { name: 'w_sulfate', type: 'float' }, |
157 { name: 'w_sulfate', type: 'float' }, |
159 { name: 'w_chloride', type: 'float' }, |
158 { name: 'w_chloride', type: 'float' }, |
160 { name: 'w_sodium', type: 'float' }, |
159 { name: 'w_sodium', type: 'float' }, |
161 { name: 'w_magnesium', type: 'float' }, |
160 { name: 'w_magnesium', type: 'float' }, |
162 { name: 'w_ph', type: 'float' }, |
161 { name: 'w_ph', type: 'float' }, |
170 deleterow: function (rowid, commit) { |
169 deleterow: function (rowid, commit) { |
171 commit(true); |
170 commit(true); |
172 } |
171 } |
173 }; |
172 }; |
174 var waterAdapter = new $.jqx.dataAdapter(waterSource); |
173 var waterAdapter = new $.jqx.dataAdapter(waterSource); |
|
174 |
|
175 var waterUrl = "getwatersources.php"; |
|
176 var waterInvSource = { |
|
177 datatype: "json", |
|
178 datafields: [ |
|
179 { name: 'record', type: 'number' }, |
|
180 { name: 'name', type: 'string' }, |
|
181 { name: 'unlimited_stock', type: 'bool' }, |
|
182 { name: 'calcium', type: 'float' }, |
|
183 { name: 'sulfate', type: 'float' }, |
|
184 { name: 'chloride', type: 'float' }, |
|
185 { name: 'sodium', type: 'float' }, |
|
186 { name: 'magnesium', type: 'float' }, |
|
187 { name: 'ph', type: 'float' }, |
|
188 { name: 'total_alkalinity', type: 'float' }, |
|
189 { name: 'cost', type: 'float' }, |
|
190 { name: 'default_water', type: 'bool' } |
|
191 ], |
|
192 url: waterUrl, |
|
193 async: true |
|
194 }; |
|
195 var waterlist = new $.jqx.dataAdapter(waterInvSource); |
|
196 |
175 $("#waterGrid").jqxGrid({ |
197 $("#waterGrid").jqxGrid({ |
176 width: 960, |
198 width: 960, |
177 height: 200, |
199 height: 200, |
178 source: waterAdapter, |
200 source: waterAdapter, |
179 theme: theme, |
201 theme: theme, |
181 editmode: 'selectedrow', |
203 editmode: 'selectedrow', |
182 editable: true, |
204 editable: true, |
183 showtoolbar: true, |
205 showtoolbar: true, |
184 rendertoolbar: function (toolbar) { |
206 rendertoolbar: function (toolbar) { |
185 var me = this; |
207 var me = this; |
186 var container = $("<div style='margin: 5px;'></div>"); |
208 var container = $("<div style='margin: 5px; white-space: nowrap;'></div>"); |
187 toolbar.append(container); |
209 toolbar.append(container); |
188 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); |
210 // container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); |
189 container.append('<input style="margin-left: 140px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); |
211 container.append('<div id="addrowbutton"></div>'); |
190 $("#addrowbutton").jqxButton({ theme: theme, width: 150 }); |
212 container.append('<input id="deleterowbutton" type="button" value="Verwijder water" />'); |
|
213 $("#addrowbutton").jqxDropDownList({ |
|
214 placeHolder: "Kies water:", |
|
215 theme: theme, |
|
216 source: waterlist, |
|
217 displayMember: "name", |
|
218 width: 150, |
|
219 dropDownWidth: 300 |
|
220 }); |
|
221 // $("#addrowbutton").jqxButton({ theme: theme, width: 150 }); |
|
222 // $("#addrowbutton").on('click', function () { |
|
223 $("#addrowbutton").on('select', function (event) { |
|
224 // if (event.args) { |
|
225 // var index = event.args.index; |
|
226 // var datarecord = data[index]; |
|
227 // var row = {}; |
|
228 // row["w_name"] = datarecord.name; |
|
229 // row["w_amount"] = 0; |
|
230 // row["w_calcium"] = datarecord.calcium; |
|
231 // row["w_sulfate"] = datarecord.sulfate; |
|
232 // row["w_chloride"] = datarecord.chloride; |
|
233 |
|
234 // var commit = $("#waterGrid").jqxGrid('addrow', null, row); |
|
235 // } |
|
236 var row = {}; |
|
237 row["w_name"] = "Vies water"; |
|
238 row["w_amount"] = 0; |
|
239 row["w_calcium"] = 0; |
|
240 row["w_sulfate"] = 0; |
|
241 row["w_chloride"] = 0; |
|
242 row["w_sodium"] = 0; |
|
243 row["w_magnesium"] = 0; |
|
244 row["w_ph"] = 7.1; |
|
245 row["w_total_alkalinity"] = 0; |
|
246 row["w_default_water"] = 0; |
|
247 row["w_cost"] = 0; |
|
248 var commit = $("#waterGrid").jqxGrid('addrow', null, row); |
|
249 }); |
191 $("#deleterowbutton").jqxButton({ theme: theme, width: 150 }); |
250 $("#deleterowbutton").jqxButton({ theme: theme, width: 150 }); |
192 // create new row. Dropdown uit water inventory. |
251 // create new row. Dropdown uit water inventory. |
|
252 // $("#addrowbutton").on('select', function (event) { |
|
253 // var item = event.args.item; |
|
254 // }); |
193 // $("#addrowbutton").on('click', function () { |
255 // $("#addrowbutton").on('click', function () { |
194 // var datarow = generaterow(); |
256 // var datarow = generaterow(); |
195 // var commit = $("#waterGrid").jqxGrid('addrow', null, datarow); |
257 // var commit = $("#waterGrid").jqxGrid('addrow', null, datarow); |
196 // }); |
258 // }); |
197 // delete row. |
259 // delete row. |