Skip to content

Instantly share code, notes, and snippets.

@egorvinogradov
Last active April 9, 2018 16:32
Show Gist options
  • Select an option

  • Save egorvinogradov/1123b2ece9089bfde03ef2ce39cb464c to your computer and use it in GitHub Desktop.

Select an option

Save egorvinogradov/1123b2ece9089bfde03ef2ce39cb464c to your computer and use it in GitHub Desktop.
async componentDidMount(){
this.setState({isLoading: true});
const users = (await api.getAdminDashboardUsers()).data;
const rows = this.convertUsersToGridRows(users);
// Variable is out of component scope
allPlatformCompanies = (await api.getAllPlatformCompanies()).data;
await this.setState({
users,
rows,
isLoading: false,
});
setTimeout(() => {
this.refs['gridElement'].onToggleFilter(); // manually enabling filters toolbar in ReactDataGrid
}, 500);
// setTimeout(() => {
// this.scrollableGrid = document.querySelector('.react-grid-Canvas');
// this.scrollableGrid.addEventListener('wheel', this.preventMacBackSwipe);
// }, 1000);
}
// preventMacBackSwipe(e){
// if (e.deltaX && !e.deltaY) {
// const grid = this.scrollableGrid;
// const maxX = grid.scrollWidth - grid.offsetWidth;
// const scrollLeft = grid.scrollLeft;
//
// if (scrollLeft <= 0) {
// e.preventDefault();
// grid.scrollLeft = 0;
// }
//
// if (scrollLeft >= maxX) {
// e.preventDefault();
// grid.scrollLeft = maxX;
// }
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment