Bug 9456: (follow-up) move sort filters to datatables.js
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 7 May 2013 16:24:56 +0000 (12:24 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 31 Oct 2013 05:51:29 +0000 (05:51 +0000)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/js/datatables.js
koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt

index cca389d..5015da2 100644 (file)
@@ -580,3 +580,38 @@ $.fn.dataTableExt.oSort['nsb-nse-desc'] = function(a,b) {
     b = b.replace(pattern, "");
     return (b > a) ? 1 : ((b < a) ? -1 : 0);
 }
+
+/* Define two custom functions (asc and desc) for basket callnumber sorting */
+jQuery.fn.dataTableExt.oSort['callnumbers-asc']  = function(x,y) {
+        var x_array = x.split("<div>");
+        var y_array = y.split("<div>");
+
+        /* Pop the first elements, they are empty strings */
+        x_array.shift();
+        y_array.shift();
+
+        x_array.sort();
+        y_array.sort();
+
+        x = x_array.shift();
+        y = y_array.shift();
+
+        return ((x < y) ? -1 : ((x > y) ?  1 : 0));
+};
+
+jQuery.fn.dataTableExt.oSort['callnumbers-desc'] = function(x,y) {
+        var x_array = x.split("<div>");
+        var y_array = y.split("<div>");
+
+        /* Pop the first elements, they are empty strings */
+        x_array.shift();
+        y_array.shift();
+
+        x_array.sort();
+        y_array.sort();
+
+        x = x_array.pop();
+        y = y_array.pop();
+
+        return ((x < y) ?  1 : ((x > y) ? -1 : 0));
+};
index b2fecc7..81ace53 100644 (file)
@@ -90,41 +90,6 @@ function placeHold () {
         $(".hold").text(_("Place Hold"));
         $("#downloadcartc").empty();
 
-        /* Define two custom functions (asc and desc) for string sorting */
-        jQuery.fn.dataTableExt.oSort['callnumbers-asc']  = function(x,y) {
-                var x_array = x.split("<div>");
-                var y_array = y.split("<div>");
-
-                /* Pop the first elements, they are empty strings */
-                x_array.shift();
-                y_array.shift();
-
-                x_array.sort();
-                y_array.sort();
-
-                x = x_array.shift();
-                y = y_array.shift();
-
-                return ((x < y) ? -1 : ((x > y) ?  1 : 0));
-        };
-
-        jQuery.fn.dataTableExt.oSort['callnumbers-desc'] = function(x,y) {
-                var x_array = x.split("<div>");
-                var y_array = y.split("<div>");
-
-                /* Pop the first elements, they are empty strings */
-                x_array.shift();
-                y_array.shift();
-
-                x_array.sort();
-                y_array.sort();
-
-                x = x_array.pop();
-                y = y_array.pop();
-
-                return ((x < y) ?  1 : ((x > y) ? -1 : 0));
-        };
-
         $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
             "sDom": 't',
             "aoColumnDefs": [