Hi,
A few questions about sorting:
Thanks,
Alvaro
Hi, thanks for your questions
componentDidMount() {
this.refs.grid.setState({sortColumn: 'column1', sortDirection: 'ASC'})
}
onGridSort will be called if the sortColumn state is set. In the meantime you could do somethign like this in your componentcomponentWillReceiveProps() {
if (this.refs.grid.state.sortColumn != null) {
// sort the rows you pass as props to ReactDataGrid
}
}
Thanks for the reply, @malonecj. Your suggestions worked fine.
@alvaro1728 Did the solution for your first question actually work?
@malonecj I'm trying to implement this as well, but it's not working for me. I see the caret showing on the column I'm trying to sort, but the data is not sorted. I have set my sort to run in componentDidMount() as suggested. My data is being fetched asynchronously, but the data is there once my data grid is created. Any other idea/solutions here?
Thanks - this is exactly what I needed when syncing the sorting widgets, for data loaded across multiple grids.
Most helpful comment
Hi, thanks for your questions
onGridSortwill be called if the sortColumn state is set. In the meantime you could do somethign like this in your component