axemclion / jquery-indexeddb

An IndexedDB Plugin for Jquery.
Other
195 stars 71 forks source link

openCursor() Issue #60

Open neerajjoshi opened 10 years ago

neerajjoshi commented 10 years ago

Hello Team,

I using IndexedDBShim.min.js and jquery.indexeddb.js in project for storing client data on local storage . The add and show data is working fine but I am unable to apply cursor query on it . Below is my code in typical indexed db structure and I want it to change as per jquery.indexeddb.js. Please help me how to change it according to jquery.indexeddb.js wrapper.

var transaction = db.transaction(["users"], "readonly"); var objectStore = transaction.objectStore("users"); var index = objectStore.index("tags");

        var rangeTest = IDBKeyRange.only(tag);
        index.openCursor(rangeTest).onsuccess = function(e) {
        var cursor = e.target.result;
        if (cursor) 
        {
            s += "<h2>Key "+cursor.key+"</h2><p>";
            for(var field in cursor.value) {
            s+= field+"="+cursor.value[field]+"<br/>";
            }
            s+="</p>";
            cursor.continue();
        }

As I am getting continuous error of openCursor() is not a function

Thanks