js/data/Collection.js
function (pageIndex, options, callback) {

            if (pageIndex < 0) {
                throw "pageIndex must be >= 0";
            }

            var page = this.$pageCache[pageIndex];
            if (!page) {
                page = this.$pageCache[pageIndex] = new Page(null, this, pageIndex);
            }

            var self = this;
            options = _.extend(this.$, options);
            page.fetch(options, function (err, page) {
                // insert data into items if not already inserted
                if (!err && !page.itemsInsertedIntoCollection) {
                    page.itemsInsertedIntoCollection = true;

                    // add items to collection
                    self.add(page.$items, {
                        index: (pageIndex || 0) * self.$.pageSize
                    });
                }

                if (callback) {
                    callback(err, page, options);
                }
            });
        }
function (pageIndex, options, callback) {

            if (pageIndex < 0) {
                throw "pageIndex must be >= 0";
            }

            var page = this.$pageCache[pageIndex];
            if (!page) {
                page = this.$pageCache[pageIndex] = new Page(null, this, pageIndex);
            }

            var self = this;
            options = _.extend(this.$, options);
            page.fetch(options, function (err, page) {
                // insert data into items if not already inserted
                if (!err && !page.itemsInsertedIntoCollection) {
                    page.itemsInsertedIntoCollection = true;

                    // add items to collection
                    self.add(page.$items, {
                        index: (pageIndex || 0) * self.$.pageSize
                    });
                }

                if (callback) {
                    callback(err, page, options);
                }
            });
        }
function ( pageIndex , options , callback ) { if ( pageIndex < 0 ) { throw "pageIndex must be >= 0" ; } var page = this . $pageCache [ pageIndex ] ; if ( ! page ) { page = this . $pageCache [ pageIndex ] = new Page ( null , this , pageIndex ) ; } var self = this ; options = _ . extend ( this . $ , options ) ; page . fetch ( options , function ( err , page ) { // insert data into items if not already inserted if ( ! err && ! page . itemsInsertedIntoCollection ) { page . itemsInsertedIntoCollection = true ; // add items to collection self . add ( page . $items , { index : ( pageIndex || 0 ) * self . $ . pageSize } ) ; } if ( callback ) { callback ( err , page , options ) ; } } ) ; }
Fetches a page and returns it in the callback

@param {Number} pageIndex - starts at 0
@param {Object} options
@param {Function} callback
Fetches a page and returns it in the callback