Class: BaseReferenceEditorController

module:core.form.editors.reference.controllers. BaseReferenceEditorController

Base data provider class for ReferenceEditorView. Data request is performed by fetching Backbone.Collection passed via options.collection option. Various scenarios are covered and server request is made only if it is required.

new BaseReferenceEditorController(options)

Parameters:
Name Type Description
options Object Options object.
Properties
Name Type Description
collection Backbone.Collection Backbone.Collection of objects. The objects must have id and text attributes. The collection must implement fetch() method that supports text filtration. For example, the call collection.fetch({ data: { filter: 'myFilterText' } }) must fetch the objects which contains 'myFilterText' in it's text attribute. Besides that, the collection.totalCount attribute must be updated during the fetch and contain the total count of object with the applied filter on server.

Methods


fetch(options)

Requests data with a text filter applied.
Parameters:
Name Type Description
options Object Options object.
Properties
Name Type Description
text Object Text filter filter to apply or null.
Returns:
Promise object that resolves when the data is ready.
Type
Promise

Handles a navigation request to an object. The method is abstract.
Parameters:
Name Type Description
value Object Value object that describes the object to navigate to.