MyCollection
Extends:
Provides a basic Backbone.Collection
using MyModel
Inherited Summary
From class Events | ||
public |
bind(): * Delegates to |
|
public |
Tell an object to listen to a particular event on an other object. |
|
public |
listenToOnce(obj: object, name: string, callback: function): Events Just like |
|
public |
Remove a previously-bound callback function from an object. |
|
public |
Bind a callback function to an object. |
|
public |
Just like |
|
public |
stopListening(obj: object, name: string, callback: function): Events Tell an object to stop listening to events. |
|
public |
Trigger callbacks for the given event, or space-delimited list of events. |
|
public |
unbind(): * Delegates to |
From class Collection | ||
public |
A comparator string indicating the attribute to sort. |
|
public |
The length of the models array. |
|
public |
The default Backbone.Model class to use as a prototype for this collection. |
|
public |
An array of models in the collection. |
|
public |
Add a model (or an array of models) to the collection, firing an "add" event for each model, and an "update" event afterwards. |
|
public |
Get a model from a collection, specified by index. |
|
public |
clone(): Collection Returns a new instance of the collection with an identical list of models. |
|
public |
Convenience to create a new instance of a model within a collection. |
|
public |
Fetch the default set of models for this collection from the server, setting them on the collection when they arrive. |
|
public |
Just like |
|
public |
Get a model from a collection, specified by an id, a cid, or by passing in a model. |
|
public abstract |
Initialize is an empty function by default. |
|
public |
Override this method to specify the attribute the collection will use to refer to its models in collection.get. |
|
public |
|
|
public |
Pluck an attribute from each model in the collection. |
|
public |
Remove and return the last model from a collection. |
|
public |
Add a model at the end of a collection. |
|
public |
Remove a model (or an array of models) from the collection, and return them. |
|
public |
Adding and removing models one at a time is all well and good, but sometimes you have so many models to change that you'd rather just update the collection in bulk. Use reset to replace a collection with a new list of models (or attribute hashes), triggering a single "reset" event at the end. Returns the newly-set models. For convenience, within a "reset" event, the list of any previous models is available as options.previousModels. Pass null for models to empty your Collection with options. Calling collection.reset() without passing any models as arguments will empty the entire collection. Here's an example using reset to bootstrap a collection during initial page load, in a Rails application: |
|
public |
The set method performs a "smart" update of the collection with the passed list of models. |
|
public |
Remove and return the first model from a collection. |
|
public |
slice(): * Return a shallow copy of this collection's models, using the same options as native |
|
public |
sort(options: object): Collection Force a collection to re-sort itself. |
|
public |
sync(): * Uses Backbone.sync to persist the state of a collection to the server. |
|
public |
Return an array containing the attributes hash of each model (via toJSON) in the collection. |
|
public |
Add a model at the beginning of a collection. |
|
public |
Return an array of all the models in a collection that match the passed attributes. |
|
protected |
_prepareModel(attrs: object, options: object): * Prepare a hash of attributes (or other model) to be added to this collection. |
|
protected |
_reset() Resets all internal state. |
From class ParseCollection | ||
public |
A comparator string indicating the attribute to sort. |
|
public |
The default Backbone.Model class to use as a prototype for this collection. |
|
public |
query: Parse.Query A Parse.Query instance |
|
public |
clone(): Collection Returns a new instance of the collection with an identical list of models. |
|
public |
Delegates to |
|
public |
Delegates to |
|
public |
|
|
public |
Delegates to |
|
public |
Delegates to |
|
public |
whereBy(query: string, options: Object): Collection Delegates to |
Public Members
public get model: MyModel: * source
Reference to this collection's model.