Browse Source

Fix #1333 "that.$selectItem is undefined" if Table option "searchText" is set.

Dennis Hernández 10 years ago
parent
commit
013459b850
1 changed files with 10 additions and 6 deletions
  1. 10 6
      src/bootstrap-table.js

+ 10 - 6
src/bootstrap-table.js

@@ -156,7 +156,7 @@
 
         if (compareLength) {
             // If number of properties is different, objects are not equivalent
-            if (objectAProperties.length != objectBProperties.length) {
+            if (objectAProperties.length !== objectBProperties.length) {
                 return false;
             }
         }
@@ -493,6 +493,7 @@
         this.initToolbar();
         this.initPagination();
         this.initBody();
+        this.initSearchText();
         this.initServer();
     };
 
@@ -1022,11 +1023,6 @@
                     that.onSearch(event);
                 }, that.options.searchTimeOut);
             });
-
-            if (this.options.searchText !== '') {
-                $search.val(this.options.searchText);
-                that.onSearch({currentTarget: $search});
-            }
         }
     };
 
@@ -1716,6 +1712,14 @@
         }
     };
 
+    BootstrapTable.prototype.initSearchText = function () {
+        if (this.options.searchText !== '') {
+            var $search = this.$toolbar.find('.search input');
+            $search.val(this.options.searchText);
+            this.onSearch({currentTarget: $search});
+        }
+    };
+
     BootstrapTable.prototype.getCaret = function () {
         var that = this;