diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 57: use http://www.datatables.net/plug-ins/sorting#numbers_html to make sort by id work as expected

Message ID 20110801161713.15445.92063.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Aug. 1, 2011, 4:17 p.m. UTC
------------------------------------------------------------
revno: 57
committer: Michael-Doyle Hudson <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2011-08-01 17:15:44 +0100
message:
  use http://www.datatables.net/plug-ins/sorting#numbers_html to make sort by id work as expected
modified:
  lava_scheduler_app/templates/lava_scheduler_app/_content.html
  lava_scheduler_app/templates/lava_scheduler_app/alljobs.html
  lava_scheduler_app/templates/lava_scheduler_app/index.html


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/_content.html'
--- lava_scheduler_app/templates/lava_scheduler_app/_content.html	2011-07-20 03:15:42 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/_content.html	2011-08-01 16:15:44 +0000
@@ -5,6 +5,23 @@ 
 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}lava-server/css/demo_table_jui.css"/>
 <script type="text/javascript" src="{{ STATIC_URL }}dashboard_app/js/FixedHeader.min.js"></script> 
 <script type="text/javascript" src="{{ STATIC_URL }}lava-server/js/jquery.dataTables.min.js"></script> 
+<script type="text/javascript">
+jQuery.fn.dataTableExt.oSort['num-html-asc']  = function(a,b) {
+	var x = a.replace( /<.*?>/g, "" );
+	var y = b.replace( /<.*?>/g, "" );
+	x = parseFloat( x );
+	y = parseFloat( y );
+	return ((x < y) ? -1 : ((x > y) ?  1 : 0));
+};
+
+jQuery.fn.dataTableExt.oSort['num-html-desc'] = function(a,b) {
+	var x = a.replace( /<.*?>/g, "" );
+	var y = b.replace( /<.*?>/g, "" );
+	x = parseFloat( x );
+	y = parseFloat( y );
+	return ((x < y) ?  1 : ((x > y) ? -1 : 0));
+};
+</script>
 {% endblock %}
 
 

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/alljobs.html'
--- lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	2011-07-26 05:31:52 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/alljobs.html	2011-08-01 16:15:44 +0000
@@ -38,7 +38,7 @@ 
     $("table.data").dataTable({
       "bJQueryUI": true,
       "aoColumnDefs": [
-        { "sType": "numeric", "aTargets": [ "id" ] }
+        { "sType": "num-html", "aTargets": [ "id" ] }
       ]
     });
   }

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/index.html'
--- lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-07-24 21:58:58 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/index.html	2011-08-01 16:15:44 +0000
@@ -55,7 +55,7 @@ 
     $("table.data").dataTable({
       "bJQueryUI": true,
       "aoColumnDefs": [
-        { "sType": "numeric", "aTargets": [ "id" ] }
+        { "sType": "num-html", "aTargets": [ "id" ] }
       ]
     });
   }