www/js/rec_edit.js

changeset 128
4d188d216c88
parent 127
6d5e215d77d2
child 129
7f41b61c3faf
equal deleted inserted replaced
127:6d5e215d77d2 128:4d188d216c88
401 async: true 401 async: true
402 }; 402 };
403 var fermentablelist = new $.jqx.dataAdapter(fermentableInvSource); 403 var fermentablelist = new $.jqx.dataAdapter(fermentableInvSource);
404 404
405 $("#fermentableGrid").jqxGrid({ 405 $("#fermentableGrid").jqxGrid({
406 width: 1050, 406 width: 1150,
407 height: 400, 407 height: 400,
408 source: fermentableAdapter, 408 source: fermentableAdapter,
409 theme: theme, 409 theme: theme,
410 selectionmode: 'singlerow', 410 selectionmode: 'singlerow',
411 editmode: 'selectedcell', 411 editmode: 'selectedcell',
415 rendertoolbar: function (toolbar) { 415 rendertoolbar: function (toolbar) {
416 var me = this; 416 var me = this;
417 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 417 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
418 toolbar.append(container); 418 toolbar.append(container);
419 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); 419 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>');
420 container.append('<input style="float: left; margin-left: 230px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); 420 container.append('<input style="float: left; margin-left: 505px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />');
421 // add fermentable from dropdownlist. 421 // add fermentable from dropdownlist.
422 $("#faddrowbutton").jqxDropDownList({ 422 $("#faddrowbutton").jqxDropDownList({
423 placeHolder: "Kies mout:", 423 placeHolder: "Kies mout:",
424 theme: theme, 424 theme: theme,
425 source: fermentablelist, 425 source: fermentablelist,
491 ready: function() { 491 ready: function() {
492 calcFermentables(); 492 calcFermentables();
493 $('#jqxTabs').jqxTabs('next'); 493 $('#jqxTabs').jqxTabs('next');
494 }, 494 },
495 columns: [ 495 columns: [
496 { text: 'Mout/suiker', editable: false, datafield: 'f_name', 496 { text: 'Vergistbaar ingredi&euml;nt', editable: false, datafield: 'f_name',
497 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { 497 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
498 var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row); 498 var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row);
499 return "<span style='margin: 3px; margin-top: 6px; float: "+columnproperties.cellsalign+"'>" +rowData.f_name + " (" + rowData.f_color + " EBC)</span>"; 499 return "<span style='margin: 3px; margin-top: 6px; float: "+columnproperties.cellsalign+"'>" +rowData.f_name + " (" + rowData.f_color + " EBC)</span>";
500 } 500 }
501 }, 501 },
502 { text: 'Type', editable: false, width: 100, datafield: 'f_type' }, 502 { text: 'Type', editable: false, align: 'center', cellsalign: 'center', width: 100, datafield: 'f_type' },
503 { text: 'Moment', width: 110, align: 'center', cellsalign: 'center', datafield: 'f_added', columntype: 'dropdownlist', 503 { text: 'Moment', width: 110, align: 'center', cellsalign: 'center', datafield: 'f_added', columntype: 'dropdownlist',
504 createeditor: function (row, column, editor) { 504 createeditor: function (row, column, editor) {
505 var srcAdded = [ "Mash", "Boil", "Fermentation", "Lagering", "Bottle" ]; 505 var srcAdded = [ "Mash", "Boil", "Fermentation", "Lagering", "Bottle" ];
506 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcAdded }); 506 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcAdded });
507 } 507 }
508 }, 508 },
509 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 509 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
510 { text: 'Gewicht Kg', datafield: 'f_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', 510 { text: 'Gewicht Kg', datafield: 'f_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3',
511 columntype: 'numberinput', 511 columntype: 'numberinput',
512 validation: function (cell, value) { 512 validation: function (cell, value) {
513 // Maximum weight is the batch_size, just a simple check. 513 // Maximum weight is the batch_size, just a simple check.
514 var maxmout = parseFloat($("#batch_size").jqxNumberInput('decimal')); 514 var maxmout = parseFloat($("#batch_size").jqxNumberInput('decimal'));
519 }, 519 },
520 initeditor: function (row, cellvalue, editor) { 520 initeditor: function (row, cellvalue, editor) {
521 editor.jqxNumberInput({ inputMode: 'simple', decimalDigits: 3 }); 521 editor.jqxNumberInput({ inputMode: 'simple', decimalDigits: 3 });
522 } 522 }
523 }, 523 },
524 { text: 'Procent', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p1', 524 { text: 'Percentage', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p1',
525 columntype: 'numberinput', 525 columntype: 'numberinput',
526 validation: function (cell, value) { 526 validation: function (cell, value) {
527 if (value < 0 || value > 100) { 527 if (value < 0 || value > 100) {
528 return { result: false, message: "Percentage moet 0-100 zijn" }; 528 return { result: false, message: "Percentage moet 0-100 zijn" };
529 } 529 }

mercurial