Browse Source

Fix #77: After searching and then clearing the search field, table is no longer sortable.

zhixin 11 years ago
parent
commit
db26725304
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/bootstrap-table.js

+ 3 - 3
src/bootstrap-table.js

@@ -521,16 +521,16 @@
         if (this.options.sidePagination !== 'server') {
             var s = that.searchText.toLowerCase();
 
-            this.data = $.grep(this.options.data, function (item) {
+            this.data = s ? $.grep(this.options.data, function (item) {
                 for (var key in item) {
                     if ((typeof item[key] === 'string' ||
                         typeof item[key] === 'number') &&
                         (item[key] + '').toLowerCase().indexOf(s) !== -1) {
-                            return true;
+                        return true;
                     }
                 }
                 return false;
-            });
+            }) : this.options.data;
         }
         this.options.pageNumber = 1;
         this.updatePagination();