superfeedr / indexeddb-backbonejs-adapter

An indexedDB adapter for Backbonejs
http://blog.superfeedr.com/indexeddb-backbonejs-adapter/
MIT License
248 stars 61 forks source link

Error: No Cursor (on fetch with condition) #83

Open exos opened 9 years ago

exos commented 9 years ago

Hi, I'm developing an application with cordova for android and I'm using this library for local persistence with backbone, but I have an error when I do a fetch with condition (equal).

Mi collection:

var Products = Backbone.Collection.extend({
        database: db,
        storeName: 'Products',
        model: Product,
        ready: false,

        comparator: 'addDate', 

        byKid: function (kid, options, cb) {
            var self = this;

            if (typeof options === 'function') {
                cb = options;
                options = undefined;
            }

            if (typeof kid === 'object') {
                kid = kid.get('kid');           
            }

            this.fetch({
                conditions: {
                    kid: kid
                },
                success: function () {
                    self.ready = true;
                    self.trigger('ready');
                    cb(null);
                },
                error: function (m, e) {
                    self.trigger('error', e);
                    cb(e);
                }
            });
        },
       // ...

This execute the errback with a String (not Error object), saying: "No Cursor".