www/js/profile_water.js

changeset 494
af28ebe4a779
parent 485
3cdfcdd71077
child 522
35675eadc655
--- a/www/js/profile_water.js	Fri Sep 13 23:02:38 2019 +0200
+++ b/www/js/profile_water.js	Sat Sep 14 19:04:29 2019 +0200
@@ -128,7 +128,10 @@
 				}
 			});
 		}
-	};
+	},
+	dataAdapter = new $.jqx.dataAdapter(source),
+        editrow = -1;
+
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#notes").jqxInput({ theme: theme, width: 800, height: 100 });
@@ -141,8 +144,6 @@
 	$("#ph").jqxNumberInput( Spin2pH );
 	$("#total_alkalinity").jqxNumberInput( Spin1dec );
 
-	var dataAdapter = new $.jqx.dataAdapter(source),
-	editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -151,8 +152,8 @@
 		theme: theme,
 		showstatusbar: true,
 		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"),
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
 			container.append(addButton);
 			statusbar.append(container);
 			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
@@ -249,11 +250,11 @@
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function () {
-		var rowID = -1;
+		var row, rowID = -1;
 		if (editrow >= 0) {
 			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
-		var row = {
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			calcium: parseFloat($("#calcium").jqxNumberInput('decimal')),

mercurial