(Probably) a dumb promises question

44 views
Skip to first unread message

raymon...@gmail.com

unread,
Sep 26, 2015, 4:17:51 PM9/26/15
to Dexie.js
I'm trying to handle a simple case of doing 2 where searches and waiting till they are both done so I can display the results at one time.

I tried this:

var ageQuery = db.people.where("age").between(20,50);
var anyQuery = db.people.where("name").anyOf(["Elric","Zula"]);
$.when(ageQuery, anyQuery).then(function(age, any) {

But to loop over the results using .each you end up with an async operation again. I know I'm missing something obvious here..

raymon...@gmail.com

unread,
Sep 26, 2015, 4:26:00 PM9/26/15
to Dexie.js, raymon...@gmail.com

Nevermind - I just used a transaction. So nice.

David Fahlander

unread,
Oct 9, 2015, 7:42:49 PM10/9/15
to Dexie.js
You could also use toArray() instead of each () and you'll get the result at end and can use $when() or Promise.all().

Reply all
Reply to author
Forward
0 new messages