Created
December 25, 2017 21:14
-
-
Save denisraslov/c744892f5506d10ef2873d751b68798e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Grid, Input, Select } from 'react-spreadsheet-grid'; | |
class GridContainer extends React.PureComponent { | |
constructor(props) { | |
super(props); | |
// It is initially not loaded | |
this.state = { | |
loaded: false | |
}; | |
} | |
loadEmployees(pageNumber) { | |
// Load an employees array through API | |
} | |
componentDidMount() { | |
// Load the first part of employees | |
this.page = 0; | |
this.loadEmployees(this.page).then((employees) => { | |
this.setState({ | |
employees | |
}); | |
}); | |
} | |
render() { | |
// Show a loader while employees are loading | |
if (!this.state.loaded) { | |
return ( | |
<Loader /> | |
); | |
} else { | |
return ( | |
<Grid | |
rows={this.state.employees} | |
columns={this.state.columns} | |
/> | |
); | |
} | |
} | |
} | |
export default GridContainer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment