8000 Merge remote-tracking branch 'wenzhixin/master' · coderabsolute/bootstrap-table@b0aa49d · GitHub
[go: up one dir, main page]

Skip to content

Commit b0aa49d

Browse files
committed
Merge remote-tracking branch 'wenzhixin/master'
2 parents ae27a53 + ffeb474 commit b0aa49d

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

docs/_i18n/en/documentation/column-options.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
109109
<td>data-width</td>
110110
<td>Number {Pixels or Percentage}</td>
111111
<td>undefined</td>
112-
<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
113-
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>
112+
<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>
114113
</tr>
115114
<tr>
116115
<td>sortable</td>

src/bootstrap-table.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156

157157
if (compareLength) {
158158
// If number of properties is different, objects are not equivalent
159-
if (objectAProperties.length != objectBProperties.length) {
159+
if (objectAProperties.length !== objectBProperties.length) {
160160
return false;
161161
}
162162
}
@@ -493,6 +493,7 @@
493493
this.initToolbar();
494494
this.initPagination();
495495
this.initBody();
496+
this.initSearchText();
496497
this.initServer();
497498
};
498499

@@ -1022,11 +1023,6 @@
10221023
that.onSearch(event);
10231024
}, that.options.searchTimeOut);
10241025
});
1025-
1026-
if (this.options.searchText !== '') {
1027-
$search.val(this.options.searchText);
1028-
that.onSearch({currentTarget: $search});
1029-
}
10301026
}
10311027
};
10321028

@@ -1716,6 +1712,14 @@
17161712
}
17171713
};
17181714

1715+
BootstrapTable.prototype.initSearchText = function () {
1716+
if (this.options.searchText !== '') {
1717+
var $search = this.$toolbar.find('.search input');
1718+
$search.val(this.options.searchText);
1719+
this.onSearch({currentTarget: $search});
1720+
}
1721+
};
1722+
17191723
BootstrapTable.prototype.getCaret = function () {
17201724
var that = this;
17211725

@@ -1725,7 +1729,8 @@
17251729
};
17261730

17271731
BootstrapTable.prototype.updateSelected = function () {
1728-
var checkAll = this.$selectItem.filter(':enabled').length ===
1732+
var checkAll = this.$selectItem.filter(':enabled').length &&
1733+
this.$selectItem.filter(':enabled').length ===
17291734
this.$selectItem.filter(':enabled').filter(':checked').length;
17301735

17311736
this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
@@ -2243,9 +2248,9 @@
22432248
if (!checked) {
22442249
rows = this.getSelections();
22452250
}
2251+
this.$selectAll.add(this.$selectAll_).prop('checked', checked);
22462252
this.$selectItem.filter(':enabled').prop('checked', checked);
22472253
this.updateRows();
2248-
this.updateSelected();
22492254
if (checked) {
22502255
rows = this.getSelections();
22512256
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243

244244
if (columnsCookie) {
245245
$.each(this.columns, function (i, column) {
246-
column.visible = columnsCookie.indexOf(column.field) !== -1;
246+
column.visible = $.inArray(column.field, columnsCookie) !== -1;
247247
});
248248
}
249249
};

src/extensions/reorder-columns/bootstrap-table-reorder-columns.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@
9595
clickDelay:200,
9696
beforeStop: function() {
9797
var ths = [],
98+
formatters = [],
9899
columns = [],
99100
columnsHidden = [],
100101
columnIndex = -1;
101102
that.$header.find('th').each(function (i) {
102103
ths.push($(this).data('field'));
104+
formatters.push($(this).data('formatter'));
103105
});
104106

105107
//Exist columns not shown
@@ -109,6 +111,7 @@
109111
});
110112
for (var i = 0; i < columnsHidden.length; i++) {
111113
ths.push(columnsHidden[i].field);
114+
formatters.push(columnsHidden[i].formatter);
112115
}
113116
}
114117

@@ -122,9 +125,10 @@
122125

123126
that.columns = that.columns.concat(columns);
124127
that.header.fields = ths;
128+
that.header.formatters = formatters;
125129
that.resetView();
126130
that.trigger('reorder-column', ths);
127131
}
128132
});
129133
};
130-
}(jQuery);
134+
}(jQuery);

0 commit comments

Comments
 (0)
0