-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting not really working #72
Comments
Can you post a sample of your data and your column defs?
…On Thu, Feb 9, 2017 at 8:46 AM Irene Pap ***@***.***> wrote:
Yet another sorting issue..!
I need to sort my data according to only one column with IDs, so I have
set the sort: 'asc', but sorting is not really well done. Clicking the
column header changes the sorting but in a weird way, some rows are
ordered, some are not.
I am also pivoting by 2 columns, but even when I don't, my data still is
not shown in a sorted order. Also not working if I pivot by more columns.
So pivoting is not the issue here I think.
The data that I provide are already in the order I want, so theoretically
even if i disable all sorting options, they should be shown in the order I
provide them, right? or is this not the expected behavior?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#72>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AFUmCfjY_zDlI7a2weKFIffyV2bL8IBJks5razTTgaJpZM4L8SjI>
.
|
Thank you for the quick response. I am struggling with this all day, and only when I pasted my code here for this answer I realized my mapping of the values was wrong. It works now, but only if I click 2 times on the column that needs to be sorted by default. First two clicks sorting is pretty random.
Sample data:
I want to sort on the KPI Number column. |
Ah I see the problem. You are using {
header: 'NO',
id: 'kpiNumber',
accessor: 'kpiNumber', // or `row => row.kpiNumber` (same thing)
aggregate: (values, rows) => <span>{values.length === 1 ? values[0] : ''}</span>,
display: rowInfo => <span className='awesomeClass'>{rowInfo.value}</span>,
width: 50,
sort: 'asc'
} Just remember that Let me know if that fixes the problem for you (remember to check your accessor functions for the rest of your columns as well ;) |
Sadly this doesn't fix the problem. I cleaned up all my accessor functions. Now I have to indeed click 5 times until the correct sorting is shown.
Btw I guess you mean EDIT: If I don't pivot by no columns, then sorting is correct from the start! So pivoting messes with it somehow. I'm looking at it now and I will also check my aggregate functions. This is my
EDIT 2: Turns out pivoting messes with some styles as well. If I have |
Upgrading to the newest version of |
Your good! Just glad it is working ;)
…On Fri, Feb 10, 2017 at 6:40 AM Irene Pap ***@***.***> wrote:
Upgrading to the newest version of react-table fixed my issue.
I am sorry that this was not the first step I took before even posting
here, I hope I didn't waste much of your time!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFUmCX-QW7nzHNZ0EiTxYSxuZM3zym1rks5rbGi7gaJpZM4L8SjI>
.
|
Turns out I have to re-open this. Behavior is that sorting is done within each group of pivoted columns, but the groups themselves are not sorted. Say, I would like to see SectionA - SectionB - SectionC, but they appear like: SectionA - SectionC - SectionB. I have to click to the ID column [ Maybe the sorting is applied in code before the pivoting, that's the grouped columns have sorted data, but the groups are not themselves sorted. I hope my explanation, even though not very clear, is at least helpful to point to the right direction into solving this.. |
Okay, I've verified that there was indeed a strange error happening. I've shipped a new version Instead of setting <ReactTable
defaultSorting={[{
id: 'kpiNumber',
desc: false // not necessary unless set to true, but it's good to know its there.
}]} As for your columns, make sure that accessors are returning primitives, and if you are using a function for an accessor that you set a unique ID. |
Does that work for you? |
It works!! Thank you very much for the fix, seems like it didn't break some small things after all [?]. |
Awesome. Just be sure to upgrade to the latest version. The inline column
sort key isn't used anymore, and the table will strictly use the
`defaultSorting` prop.
…On Mon, Feb 13, 2017 at 1:58 AM Irene Pap ***@***.***> wrote:
It works!!
Actually, it works if I keep sort: 'asc' in the column definition. When I
use the defaultSorting prop, it doesn't work [or well, it works as
before, that is I need to click 3 times at the column to see the correct
overall sorting].
Thank you very much for the fix, seems like it didn't break some small
things after all [?].
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFUmCedhnLrUMZ5SvhQDJj9m95jV3HXHks5rcBtFgaJpZM4L8SjI>
.
|
Hey, I have Below is my column This is the options for the table |
Hi @tannerlinsley , if I remove prop pivoted by then it works just fine. below how my table looks like:
|
Even i am some issue in react table, when I clicked on column I got data in sorted format but when it goes to next page some data from 1st page get displayed |
I would like to initially sort by distance { |
I have used Sl.No as first column,so the data will be like 1,2,3... when i try to sort other columns, Sl.No column also will be sorted, is there any way to keep it static(maybe disable it permanently)??? |
Hii, I have upgraded to the latest react-table v7 and sorting is not working.
getSortByToggleProps() isn't working I guess. |
Issue persists - react-table does not handle numerical sorting with - signed numbers. |
I am trying to use this table library with Next.js. Specifically tried implementing this example as it is https://codesandbox.io/s/fervent-panini-dico77?file=/src/makeData.ts:661-666 . But for some reason, only 20 rows are rendered. Rest of the table is blank. Then I just removed the virtualization and tried to render less number of rows. It worked but sorting just doesn't work.
|
I had to add the row model to the table object in a NextJS project:
|
Hi, I want to sort by name.fullname but fullname is in Lowercase as well as uppercase. It is sorting based on uppercase only. It is not considering lowercase. Can please help me. |
Yet another sorting issue..!
I need to sort my data according to only one column with IDs, so I have set the
sort: 'asc'
, but sorting is not really well done. Clicking the column header changes the sorting but in a weird way, some rows are ordered, some are not.I am also pivoting by 2 columns, but even when I don't, my data still is not shown in a sorted order. Also not working if I pivot by more columns. So pivoting is not the issue here I think.
The data that I provide are already in the order I want, so theoretically even if i disable all sorting options, they should be shown in the order I provide them, right? or is this not the expected behavior?
The text was updated successfully, but these errors were encountered: