Browse Source

Fixed the css problem

zhixin 3 years ago
parent
commit
bf9b6dbf6c

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

@@ -164,7 +164,6 @@ $.BootstrapTable = class extends $.BootstrapTable {
     super.init()
   }
 
-
   initBody () {
     super.initBody()
     if (!this.options.filterControl) {
@@ -500,13 +499,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
     if (this.options.height) {
       const $fixedControls = $('.fixed-table-header table thead').find('.filter-control, .no-filter-control')
 
-      if (this.options.filterControlVisible) {
-        $fixedControls.show()
-        UtilsFilterControl.fixHeaderCSS(this)
-      } else {
-        $fixedControls.hide()
-        UtilsFilterControl.fixHeaderCSS(this, '49px')
-      }
+      $fixedControls.toggle(this.options.filterControlVisible)
+      UtilsFilterControl.fixHeaderCSS(this)
     }
 
     const icon = this.options.showButtonIcons ? this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow : ''

+ 2 - 5
src/extensions/filter-control/utils.js

@@ -105,11 +105,8 @@ export function sortSelectControl (selectControl, orderBy) {
   }
 }
 
-export function fixHeaderCSS ({ $tableHeader }, pixels = '89px') {
-  if ($tableHeader.hasClass('table-sm') && pixels === '89px') {
-    $tableHeader.css('height', '49px')
-  }
-  $tableHeader.css('height', pixels)
+export function fixHeaderCSS ({ $tableHeader }) {
+  $tableHeader.css('height', $tableHeader.find('table').outerHeight(true))
 }
 
 export function getElementClass ($element) {