Skip to content

Commit 19e9c27

Browse files
committed
Fix wenzhixin#3163: showToolbar bug when using multiple extensions
1 parent 31973e7 commit 19e9c27

5 files changed

Lines changed: 12 additions & 14 deletions

File tree

‎src/extensions/export/bootstrap-table-export.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
_initToolbar = BootstrapTable.prototype.initToolbar;
4545

4646
BootstrapTable.prototype.initToolbar = function () {
47-
this.showToolbar = this.options.showExport;
47+
this.showToolbar = this.showToolbar || this.options.showExport;
4848

4949
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
5050

@@ -93,7 +93,7 @@
9393
$menu.find('li').click(function () {
9494
var type = $(this).data('type'),
9595
doExport = function () {
96-
96+
9797
if (!!that.options.exportFooter) {
9898
var data = that.getData();
9999
var $footerRow = that.$tableFooter.find("tr").first();
@@ -102,7 +102,7 @@
102102
var footerHtml = [];
103103

104104
$.each($footerRow.children(), function (index, footerCell) {
105-
105+
106106
var footerCellHtml = $(footerCell).children(".th-inner").first().html();
107107
footerData[that.columns[index].field] = footerCellHtml == ' ' ? null : footerCellHtml;
108108

@@ -119,12 +119,12 @@
119119
$(lastTableRowCell).html(footerHtml[index]);
120120
});
121121
}
122-
122+
123123
that.$el.tableExport($.extend({}, that.options.exportOptions, {
124124
type: type,
125125
escape: false
126126
}));
127-
127+
128128
if (!!that.options.exportFooter) {
129129
that.load(data);
130130
}

‎src/extensions/filter-control/bootstrap-table-filter-control.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
var sortSelectControl = function (selectControl) {
4343
selectControl = $(selectControl.get(selectControl.length - 1));
4444
var $opts = selectControl.find('option:gt(0)');
45-
45+
4646
$opts.sort(function (a, b) {
4747
a = $(a).text().toLowerCase();
4848
b = $(b).text().toLowerCase();
@@ -334,7 +334,7 @@
334334
if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
335335
return;
336336
}
337-
337+
338338
clearTimeout(event.currentTarget.timeoutId || 0);
339339
event.currentTarget.timeoutId = setTimeout(function () {
340340
that.onColumnSearch(event);
@@ -535,7 +535,7 @@
535535
};
536536

537537
BootstrapTable.prototype.initToolbar = function () {
538-
this.showToolbar = this.options.filterControl && this.options.filterShowClear;
538+
this.showToolbar = this.showToolbar || this.options.filterControl && this.options.filterShowClear;
539539

540540
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
541541

‎src/extensions/multiple-sort/bootstrap-table-multiple-sort.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,15 @@
229229
_initToolbar = BootstrapTable.prototype.initToolbar;
230230

231231
BootstrapTable.prototype.initToolbar = function() {
232-
this.showToolbar = true;
232+
this.showToolbar = this.showToolbar || this.options.showMultiSort;
233233
var that = this,
234234
sortModalSelector = 'sortModal_' + this.$el.attr('id'),
235235
sortModalId = '#' + sortModalSelector;
236236
this.$sortModal = $(sortModalId);
237237
this.sortModalSelector = sortModalSelector;
238238

239239
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
240-
240+
241241
if (that.options.sidePagination === 'server' && !isSingleSort && that.options.sortPriority !== null){
242242
var t = that.options.queryParams;
243243
that.options.queryParams = function(params) {

‎src/extensions/page-jumpto/bootstrap-table-jumpto.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
_initPagination = BootstrapTable.prototype.initPagination;
2323

2424
BootstrapTable.prototype.initPagination = function () {
25-
this.showToolbar = this.options.showExport;
26-
2725
_initPagination.apply(this, Array.prototype.slice.apply(arguments));
2826

2927
if (this.options.showJumpto) {

‎src/extensions/print/bootstrap-table-print.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
_initToolbar = BootstrapTable.prototype.initToolbar;
4444

4545
BootstrapTable.prototype.initToolbar = function () {
46-
this.showToolbar = this.options.showPrint;
46+
this.showToolbar = this.showToolbar || this.options.showPrint;
4747

4848
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
4949

@@ -68,7 +68,7 @@
6868
return value || "-";
6969
}
7070
}
71-
71+
7272
function buildTable(data,columns) {
7373
var out = "<table><thead><tr>";
7474
for(var h = 0; h < columns.length; h++) {

0 commit comments

Comments
 (0)