浏览代码

Added support for numerical sorting to initSort.

David Schunke 11 年之前
父节点
当前提交
f7778e0a20
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/bootstrap-table.js

+ 8 - 0
src/bootstrap-table.js

@@ -468,6 +468,14 @@
                     return order * value;
                     return order * value;
                 }
                 }
 
 
+                // Convert numerical values form string to float.
+                if ($.isNumeric(aa)) {
+                    aa = parseFloat(aa);
+                }
+                if ($.isNumeric(bb)) {
+                    bb = parseFloat(bb);
+                }
+
                 // Fix #161: undefined or null string sort bug.
                 // Fix #161: undefined or null string sort bug.
                 if (aa === undefined || aa === null) {
                 if (aa === undefined || aa === null) {
                     aa = '';
                     aa = '';