浏览代码

Merge pull request #5155 from wenzhixin/hotfix/fix-filter-control

Fix issue with missing methods
文翼 5 年之前
父节点
当前提交
1aed7e5d67
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/extensions/filter-control/bootstrap-table-filter-control.js

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

@@ -356,9 +356,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
     if (this.options.filterControl) {
     if (this.options.filterControl) {
       const that = this
       const that = this
       const cookies = UtilsFilterControl.collectBootstrapCookies()
       const cookies = UtilsFilterControl.collectBootstrapCookies()
-      const header = UtilsFilterControl.getCurrentHeader(that)
-      const table = header.closest('table')
-      const controls = header.find(UtilsFilterControl.getCurrentSearchControls(that))
+      const table = this.$el.closest('table')
+      const controls = UtilsFilterControl.getSearchControls(that)
       const search = that.$toolbar.find('.search input')
       const search = that.$toolbar.find('.search input')
       let hasValues = false
       let hasValues = false
       let timeoutId = 0
       let timeoutId = 0
@@ -409,7 +408,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
 
       // use the default sort order if it exists. do nothing if it does not
       // use the default sort order if it exists. do nothing if it does not
       if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
       if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
-        const sorter = header.find(Utils.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')))
+        const sorter = this.$header.find(Utils.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')))
         if (sorter.length > 0) {
         if (sorter.length > 0) {
           that.onSort({type: 'keypress', currentTarget: sorter})
           that.onSort({type: 'keypress', currentTarget: sorter})
           $(sorter).find('.sortable').trigger('click')
           $(sorter).find('.sortable').trigger('click')