Browse Source

Fix #1230, #1251: added resetSearch mothod to reset the search text.

zhixin 10 years ago
parent
commit
77dca58561
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/bootstrap-table.js

+ 8 - 1
src/bootstrap-table.js

@@ -2421,6 +2421,12 @@
         this.init();
     };
 
+    BootstrapTable.prototype.resetSearch = function (text) {
+        var $search = this.$toolbar.find('.search input');
+        $search.val(text || '');
+        this.onSearch({currentTarget: $search});
+    };
+
     // BOOTSTRAP TABLE PLUGIN DEFINITION
     // =======================
 
@@ -2446,7 +2452,8 @@
         'selectPage', 'prevPage', 'nextPage',
         'togglePagination',
         'toggleView',
-        'refreshOptions'
+        'refreshOptions',
+        'resetSearch'
     ];
 
     $.fn.bootstrapTable = function (option) {