浏览代码

Fix #3163: showToolbar bug when using multiple extensions

zhixin 8 年之前
父节点
当前提交
19e9c27aff

+ 5 - 5
src/extensions/export/bootstrap-table-export.js

@@ -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));
 
@@ -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();
@@ -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;
 
@@ -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);
                             }

+ 3 - 3
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -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();
@@ -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);
@@ -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));
 

+ 2 - 2
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -229,7 +229,7 @@
         _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;
@@ -237,7 +237,7 @@
         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) {

+ 0 - 2
src/extensions/page-jumpto/bootstrap-table-jumpto.js

@@ -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) {

+ 2 - 2
src/extensions/print/bootstrap-table-print.js

@@ -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));
 
@@ -68,7 +68,7 @@
                             return  value || "-";
                         }
                     }
-                  
+
                     function buildTable(data,columns) {
                         var out = "<table><thead><tr>";
                         for(var h = 0; h < columns.length; h++) {