Table column not sorting correct after changes in 7.5.4?

I have a table with several columns, where some are sorting correctly and some not.

See this GIF when trying to sort a column: Screen capture - 20d5b89a0ec7e5e9e15672a51bca4968 - Gyazo

Anyone else got this problem?

Hi @anon91959451,

Tables cycle through ascending, descending, and chronological order. Can you provide more information about your table? And you are using 7.5.4?

Hi

I am using 7.5.4 yes.
In the provided gyazo gif I cycle between the different cycles.

See for example ascending, at the bottom of the table is 90.7 when 81 is lowest.
And at the top you see 105, not 117.

And reversed for descending.

are tables sorting correctly for you if you visit play.grafana.org? that also uses 7.5.4.

If so, try making a new table panel on your own Grafana instance with dummy data from the Test DB datasource. Will that table sort correctly? If so, this issue is specific to your own panel, I believe.

I hope this helps narrow things down

@mattabrams

I tried the test data, only one column though, and it sorted correctly. In my table, I have multiple columns.

I tried to downgrade Grafana to 7.4.5 without changing my data, and it was sorting correctly. After upgrading back to 7.5.4 again, the sorting is wrong again.

The table format is like this:
| ID (int) | location (str) | % | active (str) | status (str) | column (str)
Where I sort the table by the “%” column.

@anon91959451 your GIF “moves” a bit too quickly to keep track of what’s happening, but I guess this is the key frame that shows the issue, when order should be ascending:

It basically looks like your data is sorted alphabetically (where 117 comes before 81), rather than in numerical order. Are you sure that your numbers aren’t somehow stored or represented as strings? That would explain what you’re seeing.

Maybe you could tell us more about your datasource/query, and any transformations that are being done in the panel. It is indeed a bit weird that this was not a problem on an older version (if you haven’t changed anything else).

The table panels on play.grafana.org don’t appear to suffer from this issue.

1 Like

I am using the simpleJSON datasource, which is getting data from a local Flask (Python) instance. No transformations are done. I can’t unfortunately share the entire table, because the data is considered private.

It seems like numbers with 2 digits (excluding those after comma), sort correctly compared to other 2 digit numbers, while the 3 digit numbers sorts compared to other 3 digit numbers.

For example, today, only 2 digit numbers where shown in the table - the sorting was as expected. See: Screen capture - 961a6cab8007ab1d4d897f8a2f380ebf - Gyazo

Got it. As, I said, I think that your numbers are being interpreted (and sorted) as strings/text, rather than numbers. Not sure if that’s related to datasource or panel treatment/transformations.

This topic was automatically closed after 365 days. New replies are no longer allowed.