Skip to end of metadata
Go to start of metadata

You can use plain Backbone Collection and Model objects in place of the Alloy versions. This does not require any special Alloy or Titanium code. Use the Backbone API to create and control Backbone objects instead of using the  createCollection  and  createModel  methods. Backbone models also do not require a model configuration file. For example:

app/controllers/index.js

These Backbone objects cannot persist to external storage without implementing the Backbone.sync method, so if you make calls to Collection.fetch, Collection.create, Model.fetch, Model.save and Model.destroy, the application throws an error.

You can use Alloy's Model-View binding mechanism to keep the local Backbone Models and Collections in sync with an Alloy view-controller.  Follow the same directions in the Alloy Model-View Binding section except instead of using the Model or Collections XML tag, you need to first initialize your model or collection in the alloy.js initializer file and add it to the Alloy.Models or Alloy.Collections namespace. For example:

app/alloy.js
app/views/index.xml
app/controllers/index.js