Bug: Sorting not working properly

See the below screenshot. The data type is Date.

The nulls seem to cause the issue. I map to {{ self ?? "1900-01-01"}} and enable sorting by mapped value, it works properly.

Hello @serggusak,

I would generally advise cleaning up data before trying to do an operation or manipulation on it.

There is nothing wrong with the data. The sorting should work on any data, including nulls. This is an apparent bug in the sorting. I found a similar bug reported for the "string" field type: Potential bug: Table sorting occasionally not working correctly

Any chance that will be fixed? This looks to me like a pretty significant bug. It was fixed for the "string" fields and was also identified for the "Default" fields. Can it be fixed for dates now?

Hello @serggusak,

Looking into this more I'm seeing you're right! We do have a bug ticket open for that similar issue, and I've linked this thread in to keep the association on our end.

This is still an open issue that we don't have a timeline on right now, but I was able to find this workaround for some column types.

  • Add a mapper to convert the value to a blank string is Falsey
  • Check 'Sort by mapped value'

1 Like

Thank you, @ugo.ago

Hello, it seems I have this bug too.

Without any filter, it works like a charm but if I made a filter on another column this colum can't be sorted :cry:

Do I need to create a dedicated ticket ?

Hey @Progz!

No need to create a separate ticket, thanks for reporting here! I'm sorry that it's still broken, the bug is on the list of things to be fixed and we'll report back here when it is.

In the meantime, would you mind sharing your column settings? Is the workaround posted above not functioning properly for you?

Hey folks! Fixes to column sorting have been pushed :slightly_smiling_face: Let me know if you're still running into issues with versions >2.112.0!

I'm still having issues with sorting, @Kabirdas
I have a column of Unix timestamps set to datetime mapping, but the sorting just isn't working. I tried the solution above from @ugo.ago, but it didn't help either.

Hey @elisam98!

What version of Retool are you running? And would you mind sharing some screenshots of how you have your table configured?

It would be particularly helpful to see the values your query is returning along with the settings for your date column.

Hi @Kabirdas,
I am facing same issue with sorting, I tried the solution above from @ugo.ago , but it didn't help
Also It's not showing proper data when I used Column type = Date Time
The time is showing incorrect when I use Column type = Auto. By using Column type = Auto datetime show correct but sorting is not working proper.


My retool version is 3.13.0

Hi @devteam,

Thanks for reaching out! I haven't been able to reproduce this yet :thinking: What does the underlying data look like? Can we see a screenshot of the table query & results?

Hi @Tess, Right now I am using DateTime. So paymentdate shows wrong time as you can see in below screen shot shows only 5:30 and 3:30 pm.
For Column type DateTime


For Column type Auto
When I used Auto for column shows time correct but sorting is not working

Hey @devteam we aren't able to repro this.

  1. Can you share some sample data so we can check with underlying data that is the same as yours.
  2. Have you tried this with the Table V2 component? Looks like you are still using the legacy table from those screenshots.

Thanks!