Browse Source

Merge remote-tracking branch 'wenzhixin/master'

Dennis Hernández 10 years ago
parent
commit
b0aa49dc21

+ 1 - 2
docs/_i18n/en/documentation/column-options.md

@@ -109,8 +109,7 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
         <td>data-width</td>
         <td>Number {Pixels or Percentage}</td>
         <td>undefined</td>
-        <td>The width of column. If not defined, the width will auto expand to fit its contents. Also you can add '%' to your number and
-		the bootstrapTable will use the percentage unit, otherwise, you can add or no the 'px' to your number and then the bootstrapTable will use the pixels</td>
+        <td>The width of column. If not defined, the width will auto expand to fit its contents. Though if the table is left responsive and sized too small this 'width' might be ignored (use min/max-width via class or such then). Also you can add '%' to your number and the bootstrapTable will use the percentage unit, otherwise, leave as number (or add 'px') to make it use pixels.</td>
     </tr>
     <tr>
         <td>sortable</td>

+ 13 - 8
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;
 
@@ -1725,7 +1729,8 @@
     };
 
     BootstrapTable.prototype.updateSelected = function () {
-        var checkAll = this.$selectItem.filter(':enabled').length ===
+        var checkAll = this.$selectItem.filter(':enabled').length &&
+            this.$selectItem.filter(':enabled').length ===
             this.$selectItem.filter(':enabled').filter(':checked').length;
 
         this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
@@ -2243,9 +2248,9 @@
         if (!checked) {
             rows = this.getSelections();
         }
+        this.$selectAll.add(this.$selectAll_).prop('checked', checked);
         this.$selectItem.filter(':enabled').prop('checked', checked);
         this.updateRows();
-        this.updateSelected();
         if (checked) {
             rows = this.getSelections();
         }

+ 1 - 1
src/extensions/cookie/bootstrap-table-cookie.js

@@ -243,7 +243,7 @@
 
         if (columnsCookie) {
             $.each(this.columns, function (i, column) {
-                column.visible = columnsCookie.indexOf(column.field) !== -1;
+                column.visible = $.inArray(column.field, columnsCookie) !== -1;
             });
         }
     };

+ 5 - 1
src/extensions/reorder-columns/bootstrap-table-reorder-columns.js

@@ -95,11 +95,13 @@
             clickDelay:200,
             beforeStop: function() {
                 var ths = [],
+                    formatters = [],
                     columns = [],
                     columnsHidden = [],
                     columnIndex = -1;
                 that.$header.find('th').each(function (i) {
                     ths.push($(this).data('field'));
+                    formatters.push($(this).data('formatter'));
                 });
 
                 //Exist columns not shown
@@ -109,6 +111,7 @@
                     });
                     for (var i = 0; i < columnsHidden.length; i++) {
                         ths.push(columnsHidden[i].field);
+                        formatters.push(columnsHidden[i].formatter);
                     }
                 }
 
@@ -122,9 +125,10 @@
 
                 that.columns = that.columns.concat(columns);
                 that.header.fields = ths;
+                that.header.formatters = formatters;
                 that.resetView();
                 that.trigger('reorder-column', ths);
             }
         });
     };
-}(jQuery);
+}(jQuery);