When catalog.json loaded into the db, I use the following to get the catalog items with a specific category:
console.log("Transaction completed, all data inserted");
loadFromDB("catalog");
// **** MY TEST CODE HERE
console.log("load by range") ;
_($.indexedDB("MyECommerceSite").objectStore("catalog").index('categories').eachKey(function(elem){
console.log("RG:"+JSON.stringify(elem)) ;
},['a']));
Nothing printed on the console. Only Action complete printed (from the line number on the console, I know that the done() is invoked).
If I remove the range parameter ['a'], the expected result printed, for example:
09-10 13:08:28.346: I/Web Console(24010): RG:{"key":["a","b"],"value":1006} at file:///android_asset/www/index.html:163
What is wrong with my usage of the range parameter?
I modify the demo from https://bitbucket.org/axemclion/indexeddb-cordova-android.git to test how jquery-indexeddb index works on an array property.
I add the categories property ( of array type) to the catalog.json, like the following:
then i create the index on the categories property:
When catalog.json loaded into the db, I use the following to get the catalog items with a specific category:
Nothing printed on the console. Only Action complete printed (from the line number on the console, I know that the done() is invoked).
If I remove the range parameter ['a'], the expected result printed, for example:
What is wrong with my usage of the range parameter?
I run the App on a Android 4.2.2 mobile phone.
Thanks a lot.
Guofeng.