prev and next functions on a collection
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
backbone-collection-iterator.js

README.md

Backbone collection iterator v0.1

Simple prev and next functionality on a backbone collection

Usage

Include backbone-collection-iterator.js after having included backbone.js:

<script type="text/javascript" src="backbone.js"></script>
<script type="text/javascript" src="backbone-collection-iterator.js"></script>

Given a model in a collection, get the prev or next based on the insertion order:

nextmodel = someCollection.next(model);
prevmodel = someCollection.prev(model);