[js/tablesorter] work around tablesorter deficiencies (bool handling)
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 09 Nov 2011 16:42:33 +0100
changeset 8071 9ab3a9406473
parent 8070 61fb207ad2d8
child 8072 cf405f58437f
[js/tablesorter] work around tablesorter deficiencies (bool handling)
web/data/cubicweb.js
web/data/jquery.tablesorter.js
--- a/web/data/cubicweb.js	Wed Nov 09 14:55:25 2011 +0100
+++ b/web/data/cubicweb.js	Wed Nov 09 16:42:33 2011 +0100
@@ -89,7 +89,7 @@
 	    return '';
 	}
 	return cw.evalJSON(sortvalue);
-}
+    }
 });
 
 
--- a/web/data/jquery.tablesorter.js	Wed Nov 09 14:55:25 2011 +0100
+++ b/web/data/jquery.tablesorter.js	Wed Nov 09 16:42:33 2011 +0100
@@ -886,10 +886,21 @@
         is: function (s) {
             return true;
         }, format: function (s) {
-            return $.trim(s.toLocaleLowerCase());
+            return $.trim(s); // CW PATCH: lowercasing decision taken in the server
         }, type: "text"
     });
 
+    // CW PATCH: ugly hack to catch booleans
+    ts.addParser({
+        id: 'boolean',
+        is: function (s) {
+            return (s == "true" || s == "false");
+        },
+       format: function (s) {
+           if (s) { return "0"; } else { return "1"; }
+       },
+      type: 'boolean'});
+
     ts.addParser({
         id: "digit",
         is: function (s, table) {