See if we can solve the sometimes not saved data.

Mon, 04 Mar 2019 14:20:48 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 04 Mar 2019 14:20:48 +0100
changeset 316
82c3bb9a40c2
parent 315
0df8d2db55fb
child 317
454851b335ad

See if we can solve the sometimes not saved data.

www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/js/rec_edit.js file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Mon Mar 04 11:40:33 2019 +0100
+++ b/www/js/prod_edit.js	Mon Mar 04 14:20:48 2019 +0100
@@ -2396,8 +2396,6 @@
 
 	function saveRecord() {
 		console.log("saveRecord()");
-
-		console.log(dataRecord.uuid);
 		var fermentablerow = $('#fermentableGrid').jqxGrid('getrows');
 		var hoprow = $('#hopGrid').jqxGrid('getrows');
 		var miscrow = $('#miscGrid').jqxGrid('getrows');
@@ -2589,10 +2587,13 @@
 			url: url,
 			cache: false,
 			data: data,
+			async: false,
 			type: "POST",
 			success: function (data, status, xhr) {
+				console.log("saveRecord() success");
 			},
 			error: function(jqXHR, textStatus, errorThrown) {
+				console.log("saveRecord() error");
 			}
 		});
 	};
@@ -5338,7 +5339,7 @@
 
 	// Buttons below
 	$("#Print").jqxButton({ template: "info", width: '80px', theme: theme });
-	$("#Print").click(function () {
+	$("#Print").bind('click', function () {
 		saveRecord();
 		// Open print in a new tab.
 		var url="prod_print.php?record=" + my_record;
@@ -5346,7 +5347,7 @@
 	});
 
 	$("#Export").jqxButton({ template: "info", width: '80px', theme: theme });
-	$("#Export").click(function () {
+	$("#Export").bind('click', function () {
 		saveRecord();
 		var url="prod_export.php?record=" + my_record + "&return=" + my_return + "&select=" + my_select +
 			"&code=" + dataRecord.code + "&name=" + dataRecord.name;
@@ -5354,7 +5355,7 @@
 	});
 
 	$("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme });
-	$("#Delete").click(function () {
+	$("#Delete").bind('click', function () {
 		// Open a popup to confirm this action.
 		$('#eventWindow').jqxWindow('open');
 		$("#delOk").click(function () {
@@ -5376,12 +5377,12 @@
 	});
 
 	$("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme });
-	$("#Cancel").click(function () {
+	$("#Cancel").bind('click', function () {
 		window.location.href = my_return;
 	});
 
 	$("#Save").jqxButton({ template: "success", width: '80px', theme: theme });
-	$("#Save").click(function () {
+	$("#Save").bind('click', function () {
 		saveRecord();
 		window.location.href = my_return;
 	});	
--- a/www/js/rec_edit.js	Mon Mar 04 11:40:33 2019 +0100
+++ b/www/js/rec_edit.js	Mon Mar 04 14:20:48 2019 +0100
@@ -1503,11 +1503,14 @@
 			dataType: 'json',
 			url: url,
 			cache: false,
+			async: false,
 			data: data,
 			type: "POST",
 			success: function (data, status, xhr) {
+				console.log("saveRecord() success");
 			},
 			error: function(jqXHR, textStatus, errorThrown) {
+				console.log("saveRecord() error");
 			}
 		});
 	};
@@ -3671,7 +3674,7 @@
 	});
 
 	$("#Print").jqxButton({ template: "info", width: '80px', theme: theme });
-	$("#Print").click(function () {
+	$("#Print").bind('click', function () {
 		saveRecord();
 		// Open print in a new tab.
 		var url="rec_print.php?record=" + my_record;
@@ -3679,14 +3682,14 @@
 	});
 
 	$("#Export").jqxButton({ template: "info", width: '80px', theme: theme });
-	$("#Export").click(function () {
+	$("#Export").bind('click', function () {
 		saveRecord();
 		var url="rec_export.php?record=" + my_record + "&return=" + my_return + "&name=" + dataRecord.name;
 		window.location.href = url;
 	});
 
 	$("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme });
-	$("#Delete").click(function () {
+	$("#Delete").bind('click', function () {
 		// Open a popup to confirm this action.
 		$('#eventWindow').jqxWindow('open');
 		$("#delOk").click(function () {
@@ -3708,12 +3711,12 @@
 	});
 
 	$("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme });
-	$("#Cancel").click(function () {
+	$("#Cancel").bind('click', function () {
 		window.location.href = my_return;
 	});
 
 	$("#Save").jqxButton({ template: "success", width: '80px', theme: theme });
-	$("#Save").click(function () {
+	$("#Save").bind('click', function () {
 		saveRecord();
 		window.location.href = my_return;
 	});

mercurial