Browse Source

HUE-1706 [beeswax] Sort numerical columns numerically not lexicographically

Added type detection
Enrico Berti 12 years ago
parent
commit
41bad76
1 changed files with 13 additions and 0 deletions
  1. 13 0
      apps/beeswax/src/beeswax/templates/watch_results.mako

+ 13 - 0
apps/beeswax/src/beeswax/templates/watch_results.mako

@@ -279,6 +279,19 @@ $(document).ready(function () {
         "sEmptyTable": "${_('No data available')}",
         "sEmptyTable": "${_('No data available')}",
         "sZeroRecords": "${_('No matching records')}",
         "sZeroRecords": "${_('No matching records')}",
     },
     },
+    "aoColumns":[
+        {"sSortDataType":"dom-text", "sType":"numeric", "sWidth":"1%" },
+        % for col in columns:
+          <%
+          sType = "string"
+          if col.type in ["TINYINT_TYPE", "SMALLINT_TYPE", "INT_TYPE", "BIGINT_TYPE", "FLOAT_TYPE", "DOUBLE_TYPE", "DECIMAL_TYPE"]:
+            sType = "numeric"
+          elif col.type in ["TIMESTAMP_TYPE", "DATE_TYPE"]:
+            sType = "date"
+          %>
+        { "sSortDataType":"dom-text", "sType":"${ sType }"},
+        % endfor
+    ],
     "fnDrawCallback": function( oSettings ) {
     "fnDrawCallback": function( oSettings ) {
       $(".resultTable").jHueTableExtender({
       $(".resultTable").jHueTableExtender({
         hintElement: "#jumpToColumnAlert",
         hintElement: "#jumpToColumnAlert",