Added multiple column sort that is possible with the latest jqwidgets to the production and recipe editors. Now the fermentables, hops, yeasts and misc ingredients now sorted in a logical order.

Thu, 30 May 2019 14:07:50 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 30 May 2019 14:07:50 +0200
changeset 380
2242521067a7
parent 379
2aa6addc1853
child 381
0ec81755396e

Added multiple column sort that is possible with the latest jqwidgets to the production and recipe editors. Now the fermentables, hops, yeasts and misc ingredients now sorted in a logical order.

www/jqwidgets/styles/jqx.ui-mbse.css file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/js/rec_edit.js file | annotate | diff | comparison | revisions
--- a/www/jqwidgets/styles/jqx.ui-mbse.css	Tue May 28 20:54:39 2019 +0200
+++ b/www/jqwidgets/styles/jqx.ui-mbse.css	Thu May 30 14:07:50 2019 +0200
@@ -89,7 +89,8 @@
 .jqx-input-button-content-ui-mbse{font-size:10px}
 .jqx-input-icon-ui-mbse{margin-left:2px; margin-top:-1px}
 .jqx-checkbox-check-checked-ui-mbse{margin-top:0px; background-position:-65px -147px; background-image:url(images/darkness/ui-icons_cccccc_256x240.png)}
-.jqx-grid-cell-sort-ui-mbse, .jqx-grid-cell-filter-ui-mbse, .jqx-grid-cell-pinned-ui-mbse{background-color:#626262;}
+/*.jqx-grid-cell-sort-ui-mbse, */
+.jqx-grid-cell-filter-ui-mbse, .jqx-grid-cell-pinned-ui-mbse{background-color:#626262;}
 .jqx-grid-cell-alt-ui-mbse, .jqx-grid-cell-sort-alt-ui-mbse, .jqx-grid-cell-filter-alt-ui-mbse{background-color:#626262}
 .jqx-splitter-collapse-button-horizontal-ui-mbse, .jqx-splitter-collapse-button-vertical-ui-mbse{ background:#ec8e0c; border:1px solid #fdd02e}
 .jqx-dropdownlist-content-ui-mbse{ color:#fff}
--- a/www/js/prod_edit.js	Tue May 28 20:54:39 2019 +0200
+++ b/www/js/prod_edit.js	Thu May 30 14:07:50 2019 +0200
@@ -3203,6 +3203,7 @@
                         height: 470,
                         source: fermentableAdapter,
                         theme: theme,
+                	sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3322,6 +3323,11 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#fermentableGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#fermentableGrid").jqxGrid('sortby', 'f_added', 'asc');
+					$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
+				}
 				calcFermentables();
                                 $('#jqxTabs').jqxTabs('next');
                         },
@@ -3432,6 +3438,7 @@
                         height: 560,
                         source: hopAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3506,6 +3513,12 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#hopGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#hopGrid").jqxGrid('sortby', 'h_useat', 'asc');
+					$("#hopGrid").jqxGrid('sortby', 'h_time', 'desc');
+					$("#hopGrid").jqxGrid('sortby', 'h_amount', 'desc');
+				}
 				calcIBUs();
                                 $('#jqxTabs').jqxTabs('next');
                         },
@@ -3691,6 +3704,7 @@
                         height: 575,
                         source: miscAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3748,6 +3762,11 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#miscGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
+					$("#miscGrid").jqxGrid('sortby', 'm_type', 'asc');
+				}
 				calcMiscs();
                                 $('#jqxTabs').jqxTabs('next');
                         },
@@ -3862,6 +3881,7 @@
                         height: 350,
                         source: yeastAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -3932,6 +3952,10 @@
                                 });
                         },
                         ready: function() {
+				var datainformation = $('#yeastGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
+				}
 				calcFermentables();
 				showStarter();
 				calcYeast();
@@ -4369,7 +4393,6 @@
 	});
 	$("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#FermentableReady").click(function () {
-		$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
 		// Recalc percentages
 		calcFermentables();
 		calcIBUs();
@@ -4596,7 +4619,6 @@
 	});
 	$("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#HopReady").click(function () {
-		$("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc');
 		calcIBUs();
 	});
 	$("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 });
@@ -4735,7 +4757,6 @@
 	});
 	$("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#MiscReady").click(function () {
-		$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
 		calcMiscs();
 	});
 	$("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 });
@@ -4843,7 +4864,6 @@
 	$("#YeastReady").click(function () {
 		calcFermentables();
 		calcYeast();
-		$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
 	});
 	$("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
 	$("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
--- a/www/js/rec_edit.js	Tue May 28 20:54:39 2019 +0200
+++ b/www/js/rec_edit.js	Thu May 30 14:07:50 2019 +0200
@@ -1776,6 +1776,7 @@
 			height: 470,
 			source: fermentableAdapter,
 			theme: theme,
+			sortmode: "many",
 			selectionmode: 'singlerow',
 			showtoolbar: true,
 			rendertoolbar: function (toolbar) {
@@ -1894,6 +1895,11 @@
 				});
 			},
 			ready: function() {
+				var datainformation = $('#fermentableGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#fermentableGrid").jqxGrid('sortby', 'f_added', 'asc');
+					$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
+				}
 				calcFermentables();
 				$('#jqxTabs').jqxTabs('next');
 			},
@@ -1995,6 +2001,7 @@
                         height: 560,
                         source: hopAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -2067,6 +2074,12 @@
                                 });
                         },
 			ready: function() {
+				var datainformation = $('#hopGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#hopGrid").jqxGrid('sortby', 'h_useat', 'asc');
+					$("#hopGrid").jqxGrid('sortby', 'h_time', 'desc');
+					$("#hopGrid").jqxGrid('sortby', 'h_amount', 'desc');
+				}
 				calcIBUs();
 				$('#jqxTabs').jqxTabs('next');
 			},
@@ -2245,6 +2258,7 @@
                         height: 575,
                         source: miscAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -2301,6 +2315,11 @@
                                 });
                         },
 			ready: function() {
+				var datainformation = $('#miscGrid').jqxGrid('getdatainformation');
+				if (datainformation.rowscount) {
+					$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
+					$("#miscGrid").jqxGrid('sortby', 'm_type', 'asc');
+				}
 				$('#jqxTabs').jqxTabs('next');
 			},
 			columns: [
@@ -2405,6 +2424,7 @@
                         height: 350,
                         source: yeastAdapter,
                         theme: theme,
+			sortmode: "many",
                         selectionmode: 'singlerow',
                         showtoolbar: true,
                         rendertoolbar: function (toolbar) {
@@ -2472,6 +2492,10 @@
                                 });
                         },
 			ready: function() {
+				var datainformation = $('#yeastGrid').jqxGrid('getdatainformation');
+                                if (datainformation.rowscount) {
+					$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
+				}
 				calcFermentables();
 				$('#jqxTabs').jqxTabs('next');
 			},
@@ -2838,7 +2862,6 @@
 	});
 	$("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#FermentableReady").click(function () {
-		$("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
 		// Recalc percentages
 		calcFermentables();
 		calcIBUs();
@@ -3066,7 +3089,6 @@
 	});
 	$("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#HopReady").click(function () {
-		$("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc');
 		calcIBUs();
 	});
 	$("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 });
@@ -3205,9 +3227,6 @@
 		modalOpacity: 0.40
 	});
 	$("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme });
-	$("#MiscReady").click(function () {
-		$("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
-	});
 	$("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 });
 	$("#wm_instock").jqxCheckBox({ theme: theme, height: 23 });
 	$("#wm_instock").on('change', function (event) {
@@ -3309,7 +3328,6 @@
 	$("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme });
 	$("#YeastReady").click(function () {
 		calcFermentables();
-		$("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
 	});
 	$("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
 	$("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 });

mercurial