Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including ordered-collection-view with all npm packages installed. Try it out:

var orderedCollectionView = require("ordered-collection-view")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ordered-collection-view v1.0.6

CollectionView manages a list of DOM elements using a Backbone.Collection - call orderDOMAccordingToCollection to synchronize the child elements of your view with options.collection. - Models that are in options.collection that do not correspond to direct children of this.el are used to construct new views using options.construct and appended to this.el - Direct children of this.el that do not correspond to a model in options.collection are detached. - Direct children of in this.el are ordered according to the index of their corresponding model in this.collection. Re-ordering is performed in-place to minimize the commotion that the DOM is subjected to. - call orderCollectionAccordingToDOM to synchronize the elements in options.collection with the child elements of this.el. - Models in options.collection that are do not correspond to direct children of this.el are removed from options.collection. - Elements that are direct children of this.el, but do not correspond to a model in the collection are left alone. - The remaining models in the collection are sorted according to the order in which they appear relative to their siblings

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free