I would like to define an initial sorting based on data retrieved (unsorted) from the server.
I have tried to use the 'sorted' property on the ReactTable component, but that seems to break changing the sorting by clicking on the column headers.
I have tried to use the 'defaultSorting' property, but that does not seem to have any effect.
Please provide a snippet showing how to set this up. Thank you!
Default sorting should work. Can you please post your code?
On Thu, Jun 1, 2017 at 8:14 AM Dr. Erich W. Schreiner <
[email protected]> wrote:
Problem Description
I would like to define an initial sorting based on data retrieved
(unsorted) from the server.I have tried to use the 'sorted' property on the ReactTable component, but
that seems to break changing the sorting by clicking on the column headers.I have tried to use the 'defaultSorting' property, but that does not seem
to have any effect.Please provide a snippet showing how to set this up. Thank you!
System Information
- react-table 6.0.5
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tannerlinsley/react-table/issues/313, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AFUmCVdsKM23B6ykw6TPElJeM3wg60UAks5r_scogaJpZM4NtCoU
.
Here you go:
defaultSorting={[{
id : 'start',
desc : true,
}]}
and the related column definition:
{
Header : 'from',
accessor: 'start',
width: 100,
}
The objects in the data array contain an ISO date as field 'start' e.g. '2017-06-01'. The data are displayed unsorted initially. No 'sort' indicator is displayed in the header column.
Thank you for the lightning fast response & best regards,
Erich
If you're using version > 6.0.0 then the key is defaultSorted I believe.
@aaronschwartz you're a hero :-)
Most helpful comment
If you're using version > 6.0.0 then the key is
defaultSortedI believe.