Class Ember.DataAdapter

public

The DataAdapter helps a data persistence library interface with tools that debug Ember such as the Ember Extension for Chrome and Firefox.

This class will be extended by a persistence library which will override some of the methods with library-specific code.

The methods likely to be overridden are:

  • getFilters
  • detect
  • columnsForType
  • getRecords
  • getRecordColumnValues
  • getRecordKeywords
  • getRecordFilterValues
  • getRecordColor
  • observeRecord

The adapter will need to be registered in the application's container as dataAdapter:main.

Example:

1
2
3
4
5
6
7
Application.initializer({
  name: "data-adapter",

  initialize: function(application) {
    application.register('data-adapter:main', DS.DataAdapter);
  }
});

Show:

Module: ember
returns
Array
List of objects defining filters. The object should have a `name` and `desc` property.

Specifies how records can be filtered. Records returned will need to have a filterValues property with a key for every name in the returned array.

Module: ember
typesAdded
Function
Callback to call to add types. Takes an array of objects containing wrapped types (returned from `wrapModelType`).
typesUpdated
Function
Callback to call when a type has changed. Takes an array of objects containing wrapped types.
returns
Function
Method to call to remove all observers

Fetch the model types and observe them for changes.

Module: ember
modelName
String
The model name.
recordsAdded
Function
Callback to call to add records. Takes an array of objects containing wrapped records. The object should have the following properties: columnValues: {Object} The key and value of a table cell. object: {Object} The actual record object.
recordsUpdated
Function
Callback to call when a record has changed. Takes an array of objects containing wrapped records.
recordsRemoved
Function
Callback to call when a record has removed. Takes the following parameters: index: The array index where the records were removed. count: The number of records removed.
returns
Function
Method to call to remove all observers.

Fetch the records of a given type and observe them for changes.