Browse Source

Merge pull request #5591 from wenzhixin/fix/4755

Updated the stickyHeader offset options to number
Dustin Utecht 4 years ago
parent
commit
59174217f6

+ 5 - 5
site/docs/extensions/sticky-header.md

@@ -37,11 +37,11 @@ This is an extension which provides a sticky header for the table when scrolling
 
 - **attribute:** `data-sticky-header-offset-left`
 
-- **type:** `Number | String`
+- **type:** `Number`
 
 - **Detail:**
 
-   Set the left offset of the sticky header container.
+   Set the left offset of the sticky header container. If the body padding left is `60px`, this value would be `60`.
 
 - **Default:** `0`
 
@@ -49,11 +49,11 @@ This is an extension which provides a sticky header for the table when scrolling
 
 - **attribute:** `data-sticky-header-offset-right`
 
-- **type:** `Number | String`
+- **type:** `Number`
 
 - **Detail:**
 
-   Set the right offset of the sticky header container.
+   Set the right offset of the sticky header container. If the body padding right is `60px`, this value would be `60`.
 
 - **Default:** `0`
 
@@ -65,6 +65,6 @@ This is an extension which provides a sticky header for the table when scrolling
 
 - **Detail:**
 
-   Set the Y offset from the top of the window to pin the sticky header. If there is a fixed navigation bar with a height of 60px, this value would be `60`.
+   Set the Y offset from the top of the window to pin the sticky header. If there is a fixed navigation bar with a height of `60px`, this value would be `60`.
 
 - **Default:** `0`

+ 2 - 2
src/extensions/sticky-header/bootstrap-table-sticky-header.js

@@ -121,8 +121,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
         stickyHeaderOffsetRight = 0
       }
       this.$stickyContainer.css('top', `${this.options.stickyHeaderOffsetY}px`)
-      this.$stickyContainer.css('left', `${stickyHeaderOffsetLeft}`)
-      this.$stickyContainer.css('right', `${stickyHeaderOffsetRight}`)
+      this.$stickyContainer.css('left', `${stickyHeaderOffsetLeft}px`)
+      this.$stickyContainer.css('right', `${stickyHeaderOffsetRight}px`)
       // create scrollable container for header
       this.$stickyTable = $('<table/>')
       this.$stickyTable.addClass(this.options.classes)