diff -r fc21dcfbe51d -r ce814c787b79 www/js/profile_mash.js --- a/www/js/profile_mash.js Thu Sep 12 20:33:33 2019 +0200 +++ b/www/js/profile_mash.js Thu Sep 12 23:03:12 2019 +0200 @@ -47,14 +47,14 @@ var steprow = 0; var stepData = {}; var dataRecord = {}; - var url = "includes/db_profile_mash.php"; + var url = 'includes/db_profile_mash.php'; // tooltips $("#name").jqxTooltip({ content: 'De naam voor dit maisch profiel.' }); $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit maisch profiel.' }); // prepare the data var source = { - datatype: "json", + datatype: 'json', cache: false, datafields: [ { name: 'record', type: 'number' }, @@ -72,13 +72,14 @@ url: url, cache: false, data: data, - type: "POST", + type: 'POST', success: function (data, status, xhr) { - // delete command is executed. commit(true); + console.log('mash deleterow ' + rowid + ' success'); }, error: function (jqXHR, textStatus, errorThrown) { commit(false); + console.log('mash deleterow ' + textStatus); } }); }, @@ -92,9 +93,11 @@ type: "POST", success: function (data, status, xhr) { commit(true); + console.log('mash addrow ' + rowid + ' success'); }, error: function(jqXHR, textStatus, errorThrown) { commit(false); + console.log('mash addrow ' + textStatus); } }); }, @@ -107,11 +110,12 @@ data: data, type: "POST", success: function (data, status, xhr) { - // update command is executed. commit(true); + console.log('mash updaterow ' + rowid + ' success'); }, error: function(jqXHR, textStatus, errorThrown) { commit(false); + console.log('mash updaterow ' + textStatus); } }); } @@ -136,7 +140,9 @@ $("#m_ramp_time").jqxNumberInput( PosInt ); $("#m_ramp_time").jqxNumberInput({ Min: 1, Max: 30 }); - var dataAdapter = new $.jqx.dataAdapter(source); + var dataAdapter = new $.jqx.dataAdapter(source), + editrow = -1; + // Inline steps editor var editsteps = function (data) { var generaterow = function () { @@ -176,7 +182,6 @@ selectionmode: 'singlerow', showtoolbar: true, rendertoolbar: function (toolbar) { - var me = this; var container = $("
"); toolbar.append(container); container.append(''); @@ -186,7 +191,7 @@ // create new row. $("#addrowbutton").on('click', function () { var datarow = generaterow(); - var commit = $("#grid").jqxGrid('addrow', null, datarow); + $("#grid").jqxGrid('addrow', null, datarow); }); // delete row. $("#deleterowbutton").on('click', function () { @@ -194,7 +199,7 @@ var rowscount = $("#grid").jqxGrid('getdatainformation').rowscount; if (selectedrowindex >= 0 && selectedrowindex < rowscount) { var id = $("#grid").jqxGrid('getrowid', selectedrowindex); - var commit = $("#grid").jqxGrid('deleterow', id); + $("#grid").jqxGrid('deleterow', id); } }); }, @@ -231,7 +236,6 @@ // initialize the input fields. $("#name").jqxInput({ theme: theme, width: 480, height: 23 }); $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); - var editrow = -1; // initialize jqxGrid $("#jqxgrid").jqxGrid({ width: 1280, @@ -264,7 +268,7 @@ }, buttonclick: function (row) { editrow = row; // get the clicked row's data and initialize the input fields. - var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); + dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); $("#name").val(dataRecord.name); $("#notes").val(dataRecord.notes); editsteps(dataRecord); @@ -328,7 +332,6 @@ }); $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); - // update the edited row when the user clicks the 'Save' button. $("#Save").click(function () { var steprows = $('#grid').jqxGrid('getrows'); var rowID = -1; @@ -347,7 +350,6 @@ $('#jqxgrid').jqxGrid('addrow', null, row); } $("#popupWindow").jqxWindow('hide'); - location.reload( true ); // reload ourself. }); createDelElements(); });