Skip to content

Commit

Permalink
Fix wenzhixin#3163: showToolbar bug when using multiple extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzhixin committed Jan 4, 2018
1 parent 31973e7 commit 19e9c27
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/extensions/export/bootstrap-table-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
_initToolbar = BootstrapTable.prototype.initToolbar;

BootstrapTable.prototype.initToolbar = function () {
this.showToolbar = this.options.showExport;
this.showToolbar = this.showToolbar || this.options.showExport;

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

Expand Down Expand Up @@ -93,7 +93,7 @@
$menu.find('li').click(function () {
var type = $(this).data('type'),
doExport = function () {

if (!!that.options.exportFooter) {
var data = that.getData();
var $footerRow = that.$tableFooter.find("tr").first();
Expand All @@ -102,7 +102,7 @@
var footerHtml = [];

$.each($footerRow.children(), function (index, footerCell) {

var footerCellHtml = $(footerCell).children(".th-inner").first().html();
footerData[that.columns[index].field] = footerCellHtml == ' ' ? null : footerCellHtml;

Expand All @@ -119,12 +119,12 @@
$(lastTableRowCell).html(footerHtml[index]);
});
}

that.$el.tableExport($.extend({}, that.options.exportOptions, {
type: type,
escape: false
}));

if (!!that.options.exportFooter) {
that.load(data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
var sortSelectControl = function (selectControl) {
selectControl = $(selectControl.get(selectControl.length - 1));
var $opts = selectControl.find('option:gt(0)');

$opts.sort(function (a, b) {
a = $(a).text().toLowerCase();
b = $(b).text().toLowerCase();
Expand Down Expand Up @@ -334,7 +334,7 @@
if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
return;
}

clearTimeout(event.currentTarget.timeoutId || 0);
event.currentTarget.timeoutId = setTimeout(function () {
that.onColumnSearch(event);
Expand Down Expand Up @@ -535,7 +535,7 @@
};

BootstrapTable.prototype.initToolbar = function () {
this.showToolbar = this.options.filterControl && this.options.filterShowClear;
this.showToolbar = this.showToolbar || this.options.filterControl && this.options.filterShowClear;

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

Expand Down
4 changes: 2 additions & 2 deletions src/extensions/multiple-sort/bootstrap-table-multiple-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@
_initToolbar = BootstrapTable.prototype.initToolbar;

BootstrapTable.prototype.initToolbar = function() {
this.showToolbar = true;
this.showToolbar = this.showToolbar || this.options.showMultiSort;
var that = this,
sortModalSelector = 'sortModal_' + this.$el.attr('id'),
sortModalId = '#' + sortModalSelector;
this.$sortModal = $(sortModalId);
this.sortModalSelector = sortModalSelector;

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

if (that.options.sidePagination === 'server' && !isSingleSort && that.options.sortPriority !== null){
var t = that.options.queryParams;
that.options.queryParams = function(params) {
Expand Down
2 changes: 0 additions & 2 deletions src/extensions/page-jumpto/bootstrap-table-jumpto.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
_initPagination = BootstrapTable.prototype.initPagination;

BootstrapTable.prototype.initPagination = function () {
this.showToolbar = this.options.showExport;

_initPagination.apply(this, Array.prototype.slice.apply(arguments));

if (this.options.showJumpto) {
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/print/bootstrap-table-print.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
_initToolbar = BootstrapTable.prototype.initToolbar;

BootstrapTable.prototype.initToolbar = function () {
this.showToolbar = this.options.showPrint;
this.showToolbar = this.showToolbar || this.options.showPrint;

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

Expand All @@ -68,7 +68,7 @@
return value || "-";
}
}

function buildTable(data,columns) {
var out = "<table><thead><tr>";
for(var h = 0; h < columns.length; h++) {
Expand Down

0 comments on commit 19e9c27

Please sign in to comment.