Result.sorted reverse property isn't working
See original GitHub issueI’m trying to sort my ListView by date with the newest first. The documentation says .sorted
takes a reverse
param, but it isn’t making any difference.
My code:
let items = this.db.objects(ITEMS_TABLE);
items.sorted('dateUpdated', true);
I get the same sort order with items.sorted('dateUpdated', true);
and items.sorted('dateUpdated', false);
This is with Realm 0.10.0
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
python - sort() and reverse() functions do not work
The sort() and reverse() methods modify the list in place for economy of space when sorting or reversing a large list.
Read more >Save a sort order with a table, query, form, or report
Last-applied sort orders · Press F4 to display the property sheet. This step is unnecessary if the property sheet is already displayed. ·...
Read more >How to use sorted() and sort() in Python 3 - KnowledgeHut
A custom key function can be supplied to customize the sort order, and the reverse flag can be set to request the result...
Read more >Sort Rows to Organize Your Data - Smartsheet Learning Center
To organize your data in ascending or descending order, use the Sort Row command.
Read more >Pandas Sort: Your Guide to Sorting Data in Python - Real Python
By passing False to ascending , you reverse the sort order. Now your DataFrame is sorted in descending order by the average MPG...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@asamiller
sorted()
returns a newResults
instance, so you probably need to change to something like this:Flash forward a year later and I stumbled on the same problem. The Realm JS documentation should have mentioned in more details on how to sort properly in reverse order.
Improper reverse sorting:
Proper reverse sorting: