浏览代码

Merge pull request #292 from Cravid/master

Added support for numerical sorting to initSort.
文翼 11 年之前
父节点
当前提交
35a2782e79
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/bootstrap-table.js

+ 8 - 0
src/bootstrap-table.js

@@ -468,6 +468,14 @@
                     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.
                 if (aa === undefined || aa === null) {
                     aa = '';