diff -r 793af7691a5e -r 122f64716161 www/js/rec_edit.js --- a/www/js/rec_edit.js Sat Dec 15 21:27:01 2018 +0100 +++ b/www/js/rec_edit.js Sat Dec 15 23:22:11 2018 +0100 @@ -877,7 +877,7 @@ var hoplist = new $.jqx.dataAdapter(hopInvSource); $("#hopGrid").jqxGrid({ - width: 1150, + width: 1050, height: 400, source: hopAdapter, theme: theme, @@ -948,7 +948,13 @@ $('#jqxTabs').jqxTabs('next'); }, columns: [ - { text: 'Hop', editable: false, datafield: 'h_name' }, + { text: 'Hop', editable: false, datafield: 'h_name', + cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { + var rowData = $("#hopGrid").jqxGrid('getrowdata', row); + return "" +rowData.h_origin+" / "+rowData.h_name+""; + }, + }, { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' }, { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' }, { text: 'Alpha', editable: false, datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, @@ -1052,7 +1058,8 @@ { name: 'm_type', type: 'string' }, { name: 'm_use_use', type: 'string' }, { name: 'm_time', type: 'float' }, - { name: 'm_amount_is_weight', type: 'bool' } + { name: 'm_amount_is_weight', type: 'bool' }, + { name: 'm_weight', type: 'float' } ], addrow: function (rowid, rowdata, position, commit) { commit(true); @@ -1061,7 +1068,20 @@ commit(true); } }; - var miscAdapter = new $.jqx.dataAdapter(miscSource); + var miscAdapter = new $.jqx.dataAdapter(miscSource, { + beforeLoadComplete: function (records) { + var data = new Array(); + for (var i = 0; i < records.length; i++) { + var row = records[i]; + row.m_weight = row.m_amount * 1000; + data.push(row); + } + return data; + }, + loadError: function(jqXHR, status, error) { + $('#err').text(status + ' ' + error); + }, + }); // dropdownlist datasource from inventory_miscs var miscUrl = "getmiscsources.php"; var miscInvSource = { @@ -1117,6 +1137,7 @@ row["m_type"] = datarecord.type; row["m_use_use"] = datarecord.use_use; row["m_time"] = 0; + row["m_weight"] = 0; row["m_amount_is_weight"] = datarecord.amount_is_weight; var commit = $("#miscGrid").jqxGrid('addrow', null, row); } @@ -1146,12 +1167,11 @@ }, { datafield: 'm_amount_is_weight', hidden: true }, // We need to declare this column { datafield: 'm_amount', hidden: true }, // We need to declare this column - { text: 'Hoeveelheid', datafield: 'grammen', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f2', + { text: 'Hoeveelheid', datafield: 'm_weight', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f2', columntype: 'numberinput', cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { - var gram = rowdata.m_amount * 1000; var vstr = rowdata.m_amount_is_weight ? "gr":"ml"; - return "