-
-
Use a different item model
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
The model to use |
- Source:
Returns:
this, chainable
-
Type
-
F.ModelComponent
-
addComponent(component, componentName) → {F.Component}
-
Add an instance of another component as a sub-component.
this[subComponent.toString()]
is used to reference the sub-component:
this.List.show();
You can give a component an optional custom name as the second argument, then reference as such:
this.myCustomComponent.show();
Parameters:
Name |
Type |
Argument |
Description |
component |
F.Component
|
|
Instance of component |
componentName |
String
|
<optional>
|
Optional custom name for this component |
- Inherited From:
- Source:
Returns:
The sub-component that was added
-
Type
-
F.Component
-
bind(name)
-
Binds a method to the execution scope of this instance
Parameters:
Name |
Type |
Description |
name |
String
|
The name of the method to bind. For example, to bind this.handleClick , you would use this.bind('handleClick') |
- Inherited From:
- Source:
-
bubble(componentName, evt) → {F.Component}
-
Set an event to bubble up the component chain by re-triggering it when the given sub-component triggers it
Parameters:
Name |
Type |
Description |
componentName |
String
|
Name of the component whose event to bubble |
evt |
String
|
Name of event to bubble up |
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
destruct()
-
Destroy this instance and free associated memory
- Inherited From:
- Source:
-
-
Fetch a model with the given ID
Parameters:
Name |
Type |
Argument |
Description |
itemId |
String
|
|
ID of the item to fetch |
callback |
Function
|
<optional>
|
Callback to execute on successful fetch |
- Source:
Returns:
this, chainable
-
Type
-
F.ModelComponent
-
handleLoadError(model, response)
-
Called when a model fails to load
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
The model that failed to load |
response |
Object
|
The response from Backbone |
- Source:
-
handleLoadSuccess(model, response) → {Boolean}
-
Called when a model has been loaded successfully
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
The model that was to loaded |
response |
Object
|
The response from Backbone |
- Source:
Returns:
If false is returned, events will not be triggered and the callback will not be called
-
Type
-
Boolean
-
handleRenderComplete()
-
Called when view rendering is complete
- Inherited From:
- Source:
-
handleSaveError(model, response)
-
Called when a model fails to save
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
The model that failed to save |
response |
Object
|
The response from Backbone |
- Source:
-
handleSaveSuccess(model, response)
-
Called when a model has been saved successfully
Parameters:
Name |
Type |
Description |
model |
Backbone.Model
|
The model that was saved |
response |
Object
|
The response from Backbone |
- Source:
-
-
Hide this component
Parameters:
Name |
Type |
Argument |
Description |
options |
Object
|
<optional>
|
Options object
Properties
Name |
Type |
Argument |
Default |
Description |
silent |
Boolean
|
<optional>
|
false
|
If true, events will not be triggered |
hideChildren |
Boolean
|
<optional>
|
true
|
If false, children will not be hidden automatically |
|
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
hideAllSubComponents(except) → {F.Component}
-
Hide all sub-components
Parameters:
Name |
Type |
Argument |
Description |
except |
String[]
|
<optional>
|
List of component names not to hide. These components will not be shown if they are already hidden |
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
inDebugMode() → {Boolean}
-
Check if this component, or F as a whole, is in debug mode and should output debug messages
- Inherited From:
- Source:
Returns:
Component or F is in debug mode
-
Type
-
Boolean
-
init()
-
Performs initialization operations after all constructors have been called
- Inherited From:
- Source:
-
isVisible() → {Boolean}
-
Check if this component is currently visible
- Inherited From:
- Source:
Returns:
Component is visible
-
Type
-
Boolean
-
listenTo(other, event, callback)
-
An inversion-of-control version of on
. Tell this object to listen to
an event in another object keeping track of what it's listening to.
Parameters:
Name |
Type |
Description |
other |
Object
|
The object to listen to |
event |
String
|
Name of the event to listen to |
callback |
Function
|
Callback to execute when the event is triggered |
- Inherited From:
- Source:
-
-
Load a Backbone.Model directly or create a model from data
Parameters:
Name |
Type |
Description |
modelOrData |
mixed
|
Backbone.Model to load or Object with data to create model from |
- Source:
Returns:
this, chainable
-
Type
-
F.ModelComponent
-
mergeOptions()
-
Merge options up the prototype chain. Options defined in the child class take precedence over those defined in the parent class.
- Inherited From:
- Source:
-
off(event, callback, context)
-
Remove one or many callbacks. If context
is null, removes all
callbacks with that function. If callback
is null, removes all
callbacks for the event. If events
is null, removes all bound
callbacks for all events.
Parameters:
Name |
Type |
Argument |
Description |
event |
String
|
<optional>
|
Name of the event that is being listened to |
callback |
Function
|
<optional>
|
Callback to remove |
context |
Object
|
<optional>
|
Remove callbacks with the specified context |
- Inherited From:
- Source:
-
on(event, callback, context)
-
Bind one or more space separated events, or an events map,
to a callback
function. Passing "all"
will bind the callback to
all events fired.
Parameters:
Name |
Type |
Argument |
Description |
event |
String
|
|
Event to listen to |
callback |
Function
|
|
Callback to execute when the event is triggered |
context |
Object
|
<optional>
|
The value of this when the callback runs |
- Inherited From:
- Source:
-
once(event, callback, context)
-
Bind events to only be triggered a single time. After the first time
the callback is invoked, it will be removed.
Parameters:
Name |
Type |
Argument |
Description |
event |
String
|
|
Name of the event to listen to |
callback |
Function
|
|
Callback to execute when the event is triggered |
context |
Object
|
<optional>
|
The value of this when the callback runs |
- Inherited From:
- Source:
-
-
Refresh the model
Parameters:
Name |
Type |
Description |
callback |
Function
|
Callback to call after successful refresh |
- Source:
Returns:
this, chainable
-
Type
-
F.ModelComponent
-
removeComponent(componentName) → {F.Component}
-
Remove and destroy a sub-component
Parameters:
Name |
Type |
Description |
componentName |
String
|
Component name |
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
removeComponents() → {F.Component}
-
Remove and destroy all sub-components
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
-
Render the view associated with this component, if it has one
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
save(data, callback, options) → {F.ModelComponent}
-
Save a model to the server
Parameters:
Name |
Type |
Description |
data |
Object
|
Data to apply to model before performing save |
callback |
Function
|
Callback to execute on success/failure. Passed an error, the model, and the response from the server |
options |
Object
|
Options to pass when calling model.save |
- Source:
Returns:
this, chainable
-
Type
-
F.ModelComponent
-
setName(componentName) → {F.Component}
-
Set a custom name for this component. Only useful before passing to F.Component.addComponent
Parameters:
Name |
Type |
Description |
componentName |
String
|
Component name |
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
setPropsFromOptions(options, props) → {F.Component}
-
Set properties of this instance from an options object, then remove the properties from the options object
Parameters:
Name |
Type |
Description |
options |
Object
|
Options object with many properties |
props |
String[]
|
Properties to copy from options object |
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
setup()
-
Perform setup operations before this component is shown for the first time, such as adding sub-components
- Inherited From:
- Source:
-
-
Show this component, optionally fetching an item by ID or assigning a new model before render
Parameters:
Name |
Type |
Description |
options |
Object
|
Show options
Properties
Name |
Type |
Description |
id |
String
|
ID of model to fetch from the server before showing |
model |
Backbone.Model
|
Model to use directly (don't fetch) |
|
- Source:
Returns:
this, chainable
-
Type
-
F.ModelComponent
-
showAllSubComponents(except) → {F.Component}
-
Show all sub-components
Parameters:
Name |
Type |
Argument |
Description |
except |
String[]
|
<optional>
|
List of component names not to show. These components will not be hidden if they are already shown |
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component
-
stopListening(other, event, callback)
-
Tell this object to stop listening to either specific events or
to every object it's currently listening to.
Parameters:
Name |
Type |
Argument |
Description |
other |
Object
|
<optional>
|
The object that is being listened to |
event |
String
|
<optional>
|
Name of the event that is being listened to |
callback |
Function
|
<optional>
|
Callback to remove |
- Inherited From:
- Source:
-
teardown()
-
Perform tear-down operations after this component is hidden, such as removing sub-components. This method will not be called unless the setup() method is defined and the component has been shown previously
- Inherited From:
- Source:
-
teardownIfSetup()
-
Calls teardown() if necessary
- Inherited From:
- Source:
-
trigger(event, args)
-
Trigger one or many events, firing all bound callbacks. Callbacks are
passed the same arguments as trigger
is, apart from the event name
(unless you're listening on "all"
, which will cause your callback to
receive the true name of the event as the first argument).
Parameters:
Name |
Type |
Argument |
Description |
event |
String
|
|
Name of the event to trigger |
args |
Mixed
|
<optional>
<repeatable>
|
Arguments to pass to callback functions |
- Inherited From:
- Source:
-
unbubble(componentName, evt) → {F.Component}
-
Discontinue bubbling of a given event
Parameters:
Name |
Type |
Description |
componentName |
String
|
Name of the component whose event to stop bubbling |
evt |
String
|
Name of event that was set to bubble |
- Inherited From:
- Source:
Returns:
this, chainable
-
Type
-
F.Component