Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/MultiGrid/MultiGrid.jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe('MultiGrid', () => {
] = gridsAfter;
expect(topLeftAfter.style.getPropertyValue('height')).toEqual('125px');
expect(topRightAfter.style.getPropertyValue('height')).toEqual('125px');
expect(bottomLeftAfter.style.getPropertyValue('height')).toEqual('175px');
expect(bottomLeftAfter.style.getPropertyValue('height')).toEqual('225px');
expect(bottomRightAfter.style.getPropertyValue('height')).toEqual(
'175px',
);
Expand Down
21 changes: 16 additions & 5 deletions source/MultiGrid/MultiGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,11 @@ class MultiGrid extends React.PureComponent {
};
}

const {showHorizontalScrollbar} = this.state;
if (
resetAll ||
styleBottomLeftGrid !== this._lastRenderedStyleBottomLeftGrid
styleBottomLeftGrid !== this._lastRenderedStyleBottomLeftGrid ||
showHorizontalScrollbar !== this._lastRenderedShowHorizontalScrollbar
) {
this._bottomLeftGridStyle = {
left: 0,
Expand All @@ -481,6 +483,16 @@ class MultiGrid extends React.PureComponent {
position: 'absolute',
...styleBottomLeftGrid,
};

// When bottomRightGrid has scrollbar add height style to bottomLeftGrid
// to compensate the difference of grids containers height,
// which appears due scrollbar size.
// Without of this, bottomLeftGrid cannot be scrolled to such position as
// bottomRightGrid, which happens at the end of the grid.
if (showHorizontalScrollbar) {
const {scrollbarSize} = this.state;
this._bottomLeftGridStyle.height = `calc(100% - ${scrollbarSize}px)`;
}
}

if (
Expand Down Expand Up @@ -532,6 +544,7 @@ class MultiGrid extends React.PureComponent {
this._lastRenderedStyleTopLeftGrid = styleTopLeftGrid;
this._lastRenderedStyleTopRightGrid = styleTopRightGrid;
this._lastRenderedWidth = width;
this._lastRenderedShowHorizontalScrollbar = showHorizontalScrollbar;
}

_prepareForRender() {
Expand Down Expand Up @@ -617,14 +630,12 @@ class MultiGrid extends React.PureComponent {
rowCount,
hideBottomLeftGridScrollbar,
} = props;
const {showVerticalScrollbar} = this.state;

if (!fixedColumnCount) {
return null;
}

const additionalRowCount = showVerticalScrollbar ? 1 : 0,
height = this._getBottomGridHeight(props),
const height = this._getBottomGridHeight(props),
width = this._getLeftGridWidth(props),
scrollbarSize = this.state.showVerticalScrollbar
? this.state.scrollbarSize
Expand All @@ -641,7 +652,7 @@ class MultiGrid extends React.PureComponent {
height={height}
onScroll={enableFixedColumnScroll ? this._onScrollTop : undefined}
ref={this._bottomLeftGridRef}
rowCount={Math.max(0, rowCount - fixedRowCount) + additionalRowCount}
rowCount={Math.max(0, rowCount - fixedRowCount)}
rowHeight={this._rowHeightBottomGrid}
style={this._bottomLeftGridStyle}
tabIndex={null}
Expand Down