ソースを参照

Fixed selector scope issues

Dustin Utecht 3 年 前
コミット
5fad9aad5e

+ 1 - 1
src/bootstrap-table.js

@@ -2134,7 +2134,7 @@ class BootstrapTable {
 
     this.$el.css('margin-top', -this.$header.outerHeight())
 
-    const focused = $(':focus')
+    const focused = this.$tableHeader.find(':focus')
 
     if (focused.length > 0) {
       const $th = focused.parents('th')

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

@@ -526,7 +526,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
     // Controls in fixed header
     if (this.options.height) {
-      const $fixedControls = $('.fixed-table-header table thead').find('.filter-control, .no-filter-control')
+      const $fixedControls = this.$tableContainer.find('.fixed-table-header table thead').find('.filter-control, .no-filter-control')
 
       $fixedControls.toggle(this.options.filterControlVisible)
       UtilsFilterControl.fixHeaderCSS(this)

+ 3 - 3
src/extensions/filter-control/utils.js

@@ -18,7 +18,7 @@ export function getControlContainer (that) {
   }
 
   if (that.options.height && that._initialized) {
-    return $('.fixed-table-header table thead')
+    return that.$tableContainer.find('.fixed-table-header table thead')
   }
 
   return that.$header
@@ -590,7 +590,7 @@ export function syncHeaders (that) {
   if (!that.options.height) {
     return
   }
-  const fixedHeader = $('.fixed-table-header table thead')
+  const fixedHeader = that.$tableContainer.find('.fixed-table-header table thead')
 
   if (fixedHeader.length === 0) {
     return
@@ -600,7 +600,7 @@ export function syncHeaders (that) {
     if (element.classList[0] !== 'bs-checkbox') {
       const $element = $(element)
       const $field = $element.data('field')
-      const $fixedField = $(`th[data-field='${$field}']`).not($element)
+      const $fixedField = that.$tableContainer.find(`th[data-field='${$field}']`).not($element)
 
       const input = $element.find('input')
       const fixedInput = $fixedField.find('input')