Browse Source

Merge pull request #292 from Cravid/master

Added support for numerical sorting to initSort.
文翼 11 years ago
parent
commit
35a2782e79
1 changed files with 8 additions and 0 deletions
  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 = '';