www/js/rec_edit.js

changeset 131
71f1ca48c551
parent 130
601920b902e5
child 132
aaefac2d08a3
equal deleted inserted replaced
130:601920b902e5 131:71f1ca48c551
783 }, 783 },
784 columns: [ 784 columns: [
785 { text: 'Hop', editable: false, datafield: 'h_name' }, 785 { text: 'Hop', editable: false, datafield: 'h_name' },
786 { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' }, 786 { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' },
787 { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' }, 787 { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' },
788 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 788 { text: 'Alpha', editable: false, datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
789 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', 789 { text: 'Gewicht Kg', datafield: 'h_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f4',
790 columntype: 'numberinput', 790 columntype: 'numberinput',
791 initeditor: function (row, cellvalue, editor, celltext, pressedChar) { 791 initeditor: function (row, cellvalue, editor, celltext, pressedChar) {
792 editor.jqxNumberInput({ decimalDigits: 3, min: 0, spinButtons: false }); 792 editor.jqxNumberInput({ decimalDigits: 4, min: 0, spinButtons: false });
793 }, 793 },
794 validation: function (cell, value) { 794 validation: function (cell, value) {
795 if (value < 0 || value > 100000000000 ) { 795 if (value < 0 || value > 100000000000 ) {
796 return { result: false, message: "Volume moet 0-~ zijn" }; 796 return { result: false, message: "Volume moet 0-~ zijn" };
797 } 797 }
800 }, 800 },
801 { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'h_useat', columntype: 'dropdownlist', 801 { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'h_useat', columntype: 'dropdownlist',
802 createeditor: function (row, column, editor) { 802 createeditor: function (row, column, editor) {
803 var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; 803 var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ];
804 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcUse }); 804 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcUse });
805 },
806 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
807 if ((newvalue == "Mash") || (newvalue == "First Wort")) {
808 $("#hopGrid").jqxGrid('setcellvalue', row, "h_time", parseFloat($("#boil_time").jqxNumberInput('decimal')));
809 } else if (newvalue == "Aroma") {
810 $("#hopGrid").jqxGrid('setcellvalue', row, "h_time", 0);
811 }
805 } 812 }
806 // cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
807 // do iets met de h_time.
808 }, 813 },
809 { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', 814 { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0',
810 columntype: 'numberinput', 815 columntype: 'numberinput',
811 initeditor: function (row, cellvalue, editor, celltext, pressedChar) { 816 initeditor: function (row, cellvalue, editor, celltext, pressedChar) {
812 editor.jqxNumberInput({ decimalDigits: 0, digits: 3, min: 0 }); 817 editor.jqxNumberInput({ decimalDigits: 0, digits: 3, min: 0 });
818 },
819 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
820 var use = $("#hopGrid").jqxGrid('getcellvalue', row, "h_useat");
821 if (use != "Boil")
822 return oldvalue;
813 }, 823 },
814 validation: function (cell, value) { 824 validation: function (cell, value) {
815 var high = parseFloat($("#boil_time").jqxNumberInput('decimal')); 825 var high = parseFloat($("#boil_time").jqxNumberInput('decimal'));
816 if (value < 0 || value > high ) { 826 if (value < 0 || value > high ) {
817 return { result: false, message: "De tijd moet 0-"+high+" zijn" }; 827 return { result: false, message: "De tijd moet 0-"+high+" zijn" };
835 return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>"; 845 return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>";
836 } 846 }
837 } 847 }
838 ] 848 ]
839 }); 849 });
840 // $("#hopGrid").on('cellendedit', function (event) { 850 $("#hopGrid").on('cellendedit', function (event) {
851 var args = event.args;
852 console.log("Event Type: cellendedit, Column: " + args.datafield + ", Row: " + (args.rowindex) + ", Value: " + args.value);
853 $("#hopGrid").jqxGrid('setcellvalue', args.rowindex, args.datafield, args.value);
841 // //$('#hopGrid').jqxGrid('sortby', 'f_amount', 'desc'); 854 // //$('#hopGrid').jqxGrid('sortby', 'f_amount', 'desc');
842 // }); 855 });
843 }; 856 };
844 857
845 // Inline miscs editor 858 // Inline miscs editor
846 var editMisc = function (data) { 859 var editMisc = function (data) {
847 var miscSource = { 860 var miscSource = {

mercurial