Browse Source

Fixed sort icon not update bug

zhixin 4 years ago
parent
commit
2ef9eccfd0
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/extensions/sticky-header/bootstrap-table-sticky-header.js

+ 12 - 0
src/extensions/sticky-header/bootstrap-table-sticky-header.js

@@ -56,6 +56,18 @@ $.BootstrapTable = class extends $.BootstrapTable {
       .on('scroll', () => this.renderStickyHeader())
   }
 
+  getCaret (...args) {
+    super.getCaret(...args)
+
+    if (this.$stickyHeader) {
+      const $ths = this.$stickyHeader.find('th')
+
+      this.$header.find('th').each((i, th) => {
+        $ths.eq(i).find('.sortable').attr('class', $(th).find('.sortable').attr('class'))
+      })
+    }
+  }
+
   horizontalScroll () {
     super.horizontalScroll()
     this.$tableBody.on('scroll', () => this.matchPositionX())