Skip to content

Commit

Permalink
reverted table header scrolling
Browse files Browse the repository at this point in the history
this was a performance improvement but it's just too annoying
  • Loading branch information
TanninOne committed Apr 20, 2018
1 parent 7350d12 commit 139c7c2
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/controls/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ interface IComponentState {
detailsOpen: boolean;
rowIdsDelayed: string[];
rowVisibility: { [id: string]: boolean };
scrolling: boolean;
singleRowActions: ITableRowAction[];
multiRowActions: ITableRowAction[];
}
Expand Down Expand Up @@ -137,7 +136,6 @@ class SuperTable extends ComponentEx<IProps, IComponentState> {
detailsOpen: false,
rowIdsDelayed: [],
rowVisibility: {},
scrolling: false,
singleRowActions: this.singleRowActions(props),
multiRowActions: this.multiRowActions(props),
};
Expand Down Expand Up @@ -229,9 +227,7 @@ class SuperTable extends ComponentEx<IProps, IComponentState> {
const rowIds = Object.keys(rowState).filter(rowId => rowState[rowId].selected);

const scrollOffset = this.mScrollRef !== undefined ? this.mScrollRef.scrollTop : 0;
const headerStyle = this.state.scrolling
? { display: 'none' }
: { transform: `translate(0, ${scrollOffset}px)` };
const headerStyle = { transform: `translate(0, ${scrollOffset}px)` };

return (
<div id={`table-${tableId}`} className='table-container'>
Expand Down Expand Up @@ -716,14 +712,12 @@ class SuperTable extends ComponentEx<IProps, IComponentState> {
}

private translateHeader = (event) => {
if (!this.state.scrolling) {
this.updateState(setSafe(this.mNextState, ['scrolling'], true));
} else {
clearTimeout(this.mScrollTimer);
}
this.mScrollTimer = setTimeout(() => {
this.updateState(setSafe(this.mNextState, ['scrolling'], false));
}, 200);
window.requestAnimationFrame(() => {
if ((this.mHeadRef !== undefined) && (this.mHeadRef !== null)) {
const transform = `translate(0, ${event.target.scrollTop}px)`;
this.mHeadRef.style.transform = transform;
}
});
}

private mainPaneRef = (ref) => {
Expand Down

0 comments on commit 139c7c2

Please sign in to comment.