Skip to content

Instantly share code, notes, and snippets.

@kborchers
Last active December 11, 2015 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kborchers/4541788 to your computer and use it in GitHub Desktop.
Save kborchers/4541788 to your computer and use it in GitHub Desktop.

Below is a comparison of the method usage proposed by each lib for handling paged resources.

Read Next Page

Android

iOS

JS

cars.read({
    page: "next",
    success: function( data ) {
        // do something
    },
    error: function() {
        // handle it
    }
});

Read Previous Page

Android

iOS

JS

cars.read({
    page: "prev",
    success: function( data ) {
        // do something
    },
    error: function() {
        // handle it
    }
});

Change Offset and Limit

###Android

###iOS

###JS

cars.updatePageConfig({
    offset: 2,
    limit: 10
});

Return All Records (No longer paged)

Android

iOS

JS

// Get all records for a single read but continue paging aftwerward
cars.read({
    page: false,
    success: function( data ) {
        // do something
    },
    error: function() {
        // handle it
    }
});

// Or permanently update the config to no longer page the results
cars.updatePageConfig({
    paged: false
});

cars.read({
    success: function( data ) {
        // do something
    },
    error: function() {
        // handle it
    }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment