235 theme: theme, |
235 theme: theme, |
236 source: fermentablelist, |
236 source: fermentablelist, |
237 displayMember: "name", |
237 displayMember: "name", |
238 width: 150, |
238 width: 150, |
239 height: 27, |
239 height: 27, |
240 dropDownWidth: 300 |
240 dropDownWidth: 500, |
|
241 dropDownHeight: 500, |
|
242 renderer: function (index, label, value) { |
|
243 var datarecord = fermentablelist.records[index]; |
|
244 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; |
|
245 } |
241 }); |
246 }); |
242 $("#faddrowbutton").on('select', function (event) { |
247 $("#faddrowbutton").on('select', function (event) { |
243 if (event.args) { |
248 if (event.args) { |
244 var index = event.args.index; |
249 var index = event.args.index; |
245 var datarecord = fermentablelist.records[index]; |
250 var datarecord = fermentablelist.records[index]; |
286 }); |
291 }); |
287 }, |
292 }, |
288 columns: [ |
293 columns: [ |
289 { text: 'Mout/suiker', editable: false, datafield: 'f_name' }, |
294 { text: 'Mout/suiker', editable: false, datafield: 'f_name' }, |
290 { text: 'Type', editable: false, width: 100, datafield: 'f_type' }, |
295 { text: 'Type', editable: false, width: 100, datafield: 'f_type' }, |
291 { text: 'Opbrengst', datafield: 'f_yield', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
296 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
292 { text: 'Gewicht', datafield: 'f_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', |
297 { text: 'Gewicht', datafield: 'f_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', |
293 columntype: 'numberinput', |
298 columntype: 'numberinput', |
294 validation: function (cell, value) { |
299 validation: function (cell, value) { |
295 if (value < 0 || value > 100000000000 ) { |
300 // Maximum weight is the batch_size, just a simple check. |
296 return { result: false, message: "Volume moet 0-~ zijn" }; |
301 var maxmout = parseFloat($("#batch_size").jqxNumberInput('decimal')); |
|
302 if (value < 0 || value > maxmout) { |
|
303 return { result: false, message: "Gewicht moet 0-"+maxmout+" zijn" }; |
297 } |
304 } |
298 return true; |
305 return true; |
|
306 }, |
|
307 initeditor: function (row, cellvalue, editor) { |
|
308 editor.jqxNumberInput({ decimalDigits: 3 }); |
299 } |
309 } |
300 }, |
310 }, |
301 { text: 'Procent', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p3', |
311 { text: 'Procent', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p1', |
302 columntype: 'numberinput', |
312 columntype: 'numberinput', |
303 validation: function (cell, value) { |
313 validation: function (cell, value) { |
304 if (value < 0 || value > 100) { |
314 if (value < 0 || value > 100) { |
305 return { result: false, message: "Percentage moet 0-100 zijn" }; |
315 return { result: false, message: "Percentage moet 0-100 zijn" }; |
306 } |
316 } |
307 return true; |
317 return true; |
|
318 }, |
|
319 initeditor: function (row, cellvalue, editor) { |
|
320 editor.jqxNumberInput({ decimalDigits: 1 }); |
308 } |
321 } |
309 }, |
322 }, |
310 { text: '100%', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 80 } |
323 { text: '100%', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 80 } |
311 ] |
324 ] |
312 }) |
325 }); |
|
326 $("#fermentableGrid").on('cellendedit', function (event) { |
|
327 $('#fermentableGrid').jqxGrid('sortby', 'f_amount', 'desc'); |
|
328 }); |
313 }; |
329 }; |
314 |
330 |
315 // Inline hops editor |
331 // Inline hops editor |
316 var editHop = function (data) { |
332 var editHop = function (data) { |
317 var hopSource = { |
333 var hopSource = { |
1149 $("#jqxgrid").jqxGrid('deleterow', rowID); |
1163 $("#jqxgrid").jqxGrid('deleterow', rowID); |
1150 }); |
1164 }); |
1151 } |
1165 } |
1152 $("#popupWindow").jqxWindow('hide'); |
1166 $("#popupWindow").jqxWindow('hide'); |
1153 }); |
1167 }); |
|
1168 |
1154 $("#Cancel").jqxButton({ width: '90px', theme: theme }); |
1169 $("#Cancel").jqxButton({ width: '90px', theme: theme }); |
1155 $("#Save").jqxButton({ width: '90px', theme: theme }); |
1170 $("#Save").jqxButton({ width: '90px', theme: theme }); |
1156 // update the edited row when the user clicks the 'Save' button. |
1171 // update the edited row when the user clicks the 'Save' button. |
1157 $("#Save").click(function () { |
1172 $("#Save").click(function () { |
1158 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows'); |
1173 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows'); |