As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Kinvey.Query._postProcess supporting nested properties for sorting
J
Jason Barron
started a topic
over 9 years ago
I noticed that Kinvey.Query was not sorting data correctly when I fetched it with {offline: true}. After some debugging, I found that the Kinvey.Query._postProcess function has a comment saying it doesn't support sorting by nested fields. My first thought was, "Fair enough, it's probably a niche feature that wasn't worth implementing", but then I noticed that the function immediately below it in the source code (nested) already does the dirty work by digging out the nested property. From my (perhaps naïve) perspective, it seems like it wouldn't be too much work to switch "a[field]" to "nested(a, field)" to allow _postProcess to sort by nested fields. What do you think?
As a side note, it's a pity IndexedDB doesn't give better control over sorting..
The `_postProcess` function does not dig out nested properties, but just uses the top-level. It does support sorting by multiple fields though.
If this is a common use case for you, I can enhance the method to actually sort correctly when given a `dot.separated.field`. And yes, IndexedDB is unfortunately pretty basic, requiring a lot of code on top to make it actually useful.
J
Jason Barron
said
over 9 years ago
Hi Mark, if it's not too much work and doesn't have a noticeable impact on performance for the more common non-nested case, then I would certainly appreciate it :)
M
Mark
said
over 9 years ago
Noted, I’ll see if I can include it in the next release of the library.
M
Mark
said
over 9 years ago
This is now in the [1.1.5 release](http://devcenter.kinvey.com/downloads).
Jason Barron
As a side note, it's a pity IndexedDB doesn't give better control over sorting..