Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't use orderBy or sortBy as well? #27

Open
cmroanirgo opened this issue Dec 25, 2017 · 1 comment
Open

Can't use orderBy or sortBy as well? #27

cmroanirgo opened this issue Dec 25, 2017 · 1 comment

Comments

@cmroanirgo
Copy link

I'm having trouble figuring out how to use sortBy() or orderBy() with with():

This works fine:

db.tables.where('someIdx').equals(someIdx)
	.with({other: 'otherId'})
	.then(function(results) {
		...
	});

Adding sortBy fails:

db.tables.where('someIdx').equals(someIdx).sortBy('date')
	.with({other: 'otherId'})
	.then(function(results) {
		...
	});

Currently, my only workaround is to manually sort the results manually, which seems incorrect.

I understand why this occurs, because sortBy() returns an array (rather than staying as a collection). Unfortunately, dexie-relationships also converts the data to an array and makes the whole thing impossible to use...

It would be better if the data could be kept as a collection. (imho sortBy() suffers the same issue)

@jayarjo
Copy link

jayarjo commented Oct 14, 2019

@cmroanirgo did you find any workaround?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants