This is my code:
db.playlists
.orderBy('widPosition')
.where('widStatus')
.equals('true').
the widStatus is saved as string. I if remove the "orderBy" line
from the code, it works. I can make DEXIE show me those entries where
the widStatus either is true or false.
But as soon as i activate the orderBy, it does not work anymore.
Can anyone point me to what i am missing? Where is the error?
Thanks in advance and greetings!
Carlos
Can you direct me where i am going wrong with my code?
db.playlists
.where('widStatus')
.equals('true')
.sortBy('widPosition')
.each(function(oneItem){.....
[SOLVED]
After the each i had a "finally()".
I found out that i have to put the sortBy at the very end after the finally.
Just like David said.
Thanks so much!
Yes you may endorse Dexie in your app. That's always nice.
I'm glad you like Dexie and I wish you good luck with your app! I would advice you to read the api reference for every method you are using because it's hard to guess what class is returned without reading it. I would also advice you to read about Promises to understand how to use them properly. There's a good blog post by Nolan Lawson that I can recommend, https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html.
Finally, if you're making a chrome app, you will be safe to use the yield keyword to consume promises. Read https://github.com/dfahlander/Dexie.js/wiki/Simplify-with-yield to learn more about that. It will simplify your code a lot.
Cheers, /D
var dataPlaylist= new Array();