model.isNew

isNewmodel.isNew() Has this model been saved to the server yet? If the model does not yet have an id, it is considered to be new.

collection.comparator

comparatorcollection.comparator By default there is no comparator for a collection. If you define a comparator, it will be used to maintain the collection in sorted order. This means that as models are added, they are inserted at the correct index in collection.models. A comparator can be defined as a sortBy (pass a function that takes a single argument), as a sort (pass a comparator function that expects two arguments), or as a string indicating the attribute to sort by. "sortBy" comparato

model.defaults

defaultsmodel.defaults or model.defaults() The defaults hash (or function) can be used to specify the default attributes for your model. When creating an instance of the model, any unspecified attributes will be set to their default value. var Meal = Backbone.Model.extend({ defaults: { "appetizer": "caesar salad", "entree": "ravioli", "dessert": "cheesecake" } }); alert("Dessert will be " + (new Meal).get('dessert')); Remember that in JavaScript, objects are passe

Collection.extend

extendBackbone.Collection.extend(properties, [classProperties]) To create a Collection class of your own, extend Backbone.Collection, providing instance properties, as well as optional classProperties to be attached directly to the collection's constructor function.

view.$el

$elview.$el A cached jQuery object for the view's element. A handy reference instead of re-wrapping the DOM element all the time. view.$el.show(); listView.$el.append(itemView.el);

collection.unshift

unshiftcollection.unshift(model, [options]) Add a model at the beginning of a collection. Takes the same options as add.

model.chain

chain

Backbone.noConflict

Backbone.noConflictvar backbone = Backbone.noConflict(); Returns the Backbone object back to its original value. You can use the return value of Backbone.noConflict() to keep a local reference to Backbone. Useful for embedding Backbone on third-party websites, where you don't want to clobber the existing Backbone. var localBackbone = Backbone.noConflict(); var model = localBackbone.Model.extend(...);

router.execute

executerouter.execute(callback, args, name) This method is called internally within the router, whenever a route matches and its corresponding callback is about to be executed. Return false from execute to cancel the current transition. Override it to perform custom parsing or wrapping of your routes, for example, to parse query strings before handing them to your route callback, like so: var Router = Backbone.Router.extend({ execute: function(callback, args, name) { if (!loggedIn) {

collection.parse

parsecollection.parse(response, options) parse is called by Backbone whenever a collection's models are returned by the server, in fetch. The function is passed the raw response object, and should return the array of model attributes to be added to the collection. The default implementation is a no-op, simply passing through the JSON response. Override this if you need to work with a preexisting API, or better namespace your responses. var Tweets = Backbone.Collection.extend({ // The Twitt