ソースを参照

fix(filter-control extension): fix show-clear button bug, #1633

zhixin 9 年 前
コミット
b0a4dc98de

+ 6 - 8
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -478,23 +478,21 @@
     $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
 
     BootstrapTable.prototype.initToolbar = function () {
-        if ((!this.showToolbar) && (this.options.filterControl)) {
-            this.showToolbar = this.options.filterControl;
-        }
+        this.showToolbar = this.options.filterControl && this.options.filterShowClear;
 
         _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
 
         if (this.options.filterControl && this.options.filterShowClear) {
             var $btnGroup = this.$toolbar.find('>.btn-group'),
-                $btnClear = $btnGroup.find('div.export');
+                $btnClear = $btnGroup.find('.filter-show-clear');
 
             if (!$btnClear.length) {
-              $btnClear = $([
-                    '<button class="btn btn-default" ',
+                $btnClear = $([
+                    '<button class="btn btn-default filter-show-clear" ',
                     sprintf('type="button" title="%s">', this.options.formatClearFilters()),
                     sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.clear),
-                    '</button>',
-                    '</ul>'].join('')).appendTo($btnGroup);
+                    '</button>'
+                ].join('')).appendTo($btnGroup);
 
                 $btnClear.off('click').on('click', $.proxy(this.clearFilterControl, this));
             }