浏览代码

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

Added type detection
Enrico Berti 12 年之前
父节点
当前提交
41bad76
共有 1 个文件被更改,包括 13 次插入0 次删除
  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')}",
         "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 ) {
       $(".resultTable").jHueTableExtender({
         hintElement: "#jumpToColumnAlert",