www/js/profile_styles.js

changeset 486
e17155b3086a
parent 444
7e563dbbee32
child 494
af28ebe4a779
--- a/www/js/profile_styles.js	Fri Sep 13 15:54:23 2019 +0200
+++ b/www/js/profile_styles.js	Fri Sep 13 16:15:51 2019 +0200
@@ -44,11 +44,9 @@
 
 $(document).ready(function () {
 
-	var dataRecord = {};
-	var url = "includes/db_profile_styles.php";
-
-	// prepare the data
-	var source = {
+	var dataRecord = {},
+	url = 'includes/db_profile_styles.php',
+	source = {
 		datatype: "json",
 		cache: false,
 		datafields: [
@@ -88,8 +86,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -106,6 +104,7 @@
 				type: "POST",
 				success: function (data, status, xhr) {
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
                                         commit(false);
@@ -121,8 +120,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -170,8 +169,8 @@
 	$("#ingredients").jqxInput({ theme: theme, width: 800, height: 23 });
 	$("#examples").jqxInput({ theme: theme, width: 800, height: 48 });
 
-	var dataAdapter = new $.jqx.dataAdapter(source);
-	var editrow = -1;
+	var dataAdapter = new $.jqx.dataAdapter(source),
+	editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -180,9 +179,10 @@
 		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 impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
+			var container, addButton, impButton;
+			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>");
+			impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
 			container.append(addButton);
 			container.append(impButton);
 			statusbar.append(container);
@@ -216,8 +216,7 @@
 				$("#popupWindow").jqxWindow('open');
 			});
 			impButton.click(function (event) {
-				var url="import_ingredients.php?select=styles";
-				window.location.href = url;
+				window.location.href = 'import_ingredients.php?select=styles';
 			});
 		},
 		filterable: true,
@@ -244,7 +243,7 @@
 					// open the popup window when the user clicks a button.
 					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);
 					$("#category").val(dataRecord.category);
 					$("#category_number").val(dataRecord.category_number);
@@ -338,7 +337,6 @@
 			$('#jqxgrid').jqxGrid('addrow', null, row);
 		}
 		$("#popupWindow").jqxWindow('hide');
-		location.reload( true );        // reload ourself.
 	});
 	createDelElements();
 });

mercurial