Skip to content

Commit a1057d5

Browse files
authored
Merge pull request #23 from henrybuilt/v2-0-1
Scrollbars fixed
2 parents 6b063d3 + de73767 commit a1057d5

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

dist/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,19 +311,20 @@
311311
}, {
312312
key: 'setScrollBarDims',
313313
value: function setScrollBarDims() {
314+
var width = this.getNodeSize(this.dom.bodyTable.firstChild).width;
315+
this.dom.xScrollbar.firstChild.style.width = width + 'px';
316+
314317
this.xScrollSize = this.dom.xScrollbar.offsetHeight - this.dom.xScrollbar.clientHeight;
318+
319+
var height = this.getNodeSize(this.dom.bodyTable).height + this.xScrollSize - this.dom.stickyHeader.offsetHeight;
320+
this.dom.yScrollbar.firstChild.style.height = height + 'px';
321+
315322
this.yScrollSize = this.dom.yScrollbar.offsetWidth - this.dom.yScrollbar.clientWidth;
316323

317324
if (!this.isFirefox) {
318325
this.setScrollBarPaddings();
319326
}
320327

321-
var width = this.getNodeSize(this.dom.bodyTable.firstChild).width;
322-
this.dom.xScrollbar.firstChild.style.width = width + 'px';
323-
324-
var height = this.getNodeSize(this.dom.bodyTable).height + this.xScrollSize - this.dom.stickyHeader.offsetHeight;
325-
this.dom.yScrollbar.firstChild.style.height = height + 'px';
326-
327328
if (this.xScrollSize) this.dom.xScrollbar.style.height = this.xScrollSize + 1 + 'px';
328329
if (this.yScrollSize) this.dom.yScrollbar.style.width = this.yScrollSize + 1 + 'px';
329330
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-sticky-table",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"main": "index.js",
55
"module": "./index.js",
66
"description": "Dynamically sized fixed header and columns for tables",

src/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,20 @@ class StickyTable extends PureComponent {
257257
* @returns {undefined}
258258
*/
259259
setScrollBarDims() {
260+
var width = this.getNodeSize(this.dom.bodyTable.firstChild).width;
261+
this.dom.xScrollbar.firstChild.style.width = width + 'px';
262+
260263
this.xScrollSize = this.dom.xScrollbar.offsetHeight - this.dom.xScrollbar.clientHeight;
264+
265+
var height = this.getNodeSize(this.dom.bodyTable).height + this.xScrollSize - this.dom.stickyHeader.offsetHeight;
266+
this.dom.yScrollbar.firstChild.style.height = height + 'px';
267+
261268
this.yScrollSize = this.dom.yScrollbar.offsetWidth - this.dom.yScrollbar.clientWidth;
262269

263270
if (!this.isFirefox) {
264271
this.setScrollBarPaddings();
265272
}
266273

267-
var width = this.getNodeSize(this.dom.bodyTable.firstChild).width;
268-
this.dom.xScrollbar.firstChild.style.width = width + 'px';
269-
270-
var height = this.getNodeSize(this.dom.bodyTable).height + this.xScrollSize - this.dom.stickyHeader.offsetHeight;
271-
this.dom.yScrollbar.firstChild.style.height = height + 'px';
272-
273274
if (this.xScrollSize) this.dom.xScrollbar.style.height = this.xScrollSize + 1 + 'px';
274275
if (this.yScrollSize) this.dom.yScrollbar.style.width = this.yScrollSize + 1 + 'px';
275276
}

0 commit comments

Comments
 (0)