ソースを参照

Fix #51: Add support for number search.

zhixin 11 年 前
コミット
f4ed4ff842
1 ファイル変更5 行追加2 行削除
  1. 5 2
      src/bootstrap-table.js

+ 5 - 2
src/bootstrap-table.js

@@ -425,10 +425,13 @@
         this.searchText = text;
 
         if (this.options.sidePagination !== 'server') {
+            var s = that.searchText.toLowerCase();
+
             this.data = $.grep(this.options.data, function (item) {
                 for (var key in item) {
-                    if (typeof item[key] === 'string' &&
-                        item[key].toLowerCase().indexOf(that.searchText.toLowerCase()) !== -1) {
+                    if ((typeof item[key] === 'string' ||
+                        typeof item[key] === 'number') &&
+                        (item[key] + '').toLowerCase().indexOf(s) !== -1) {
                             return true;
                     }
                 }