-
_fetchHelper()
-
Prepare fetch.
TODO sync() alone should handle all of this stuff. fetch() is not a
Backbone customization point by design.
- Inherited From:
- Source:
-
bindEvents()
-
A function that binds events to functions. It can and should only be called
once by initialize. Any attempt to call it a second time will throw an error.
- Inherited From:
- Source:
-
build()
-
Overload: assume that anything calling this function is doing so because it
is building a model for a relation. In that case set the `isFetching` option
is true which will set it in a `BUSY_FETCHING` state when it is created.
- Inherited From:
- Source:
-
couldCreate() → {Boolean}
-
Returns whether the current record could be created on the editableModel
based on privilege settings.
- Source:
Returns:
-
Type
-
Boolean
-
couldCreate() → {Boolean}
-
Use this function to find out whether a user could create records on the
`editableModel`.
- Source:
Returns:
-
Type
-
Boolean
-
couldDelete() → {Boolean}
-
Returns whether the current record could be deleted on the editableModel
based on privilege settings.
- Source:
Returns:
-
Type
-
Boolean
-
couldDelete(model) → {Boolean}
-
Use this function to find out whether a user could delete the
`editableModel` version of this record or model.
Parameters:
Name |
Type |
Description |
model |
XM.Info
|
Optional argument to ask about a specific
model. If this is falsy we ask about the class generally. |
- Source:
Returns:
-
Type
-
Boolean
-
couldDestroy()
-
Returns whether the current record could be destroyed on the editableModel
based on privilege settings and whether it's used. Requires a callback to the
server.
- Source:
Returns:
Receiver
-
couldDestroy() → {Boolean}
-
Returns whether the current record could be destroyed on the editableModel
based on privilege settings and whether it's used. Requires a callback to the
server.
- Source:
Returns:
-
Type
-
Boolean
-
couldRead() → {Boolean}
-
Returns whether the current record could be read on the editableModel
based on privilege settings.
- Source:
Returns:
-
Type
-
Boolean
-
couldRead(model) → {Boolean}
-
Use this function to find out whether a user could read the
`editableModel` version of this record or model.
Parameters:
Name |
Type |
Description |
model |
XM.Info
|
Optional argument to ask about a specific
model. If this is falsy we ask about the class generally. |
- Source:
Returns:
-
Type
-
Boolean
-
couldUpdate() → {Boolean}
-
Returns whether the current record could be updated on the editableModel
based on privilege settings.
- Source:
Returns:
-
Type
-
Boolean
-
couldUpdate(model) → {Boolean}
-
Use this function to find out whether a user could update the
`editableModel` version of this record or model.
Parameters:
Name |
Type |
Description |
model |
XM.Info
|
Optional argument to ask about a specific
model. If this is falsy we ask about the class generally. |
- Source:
Returns:
-
Type
-
Boolean
-
destroy() → {Object|Boolean}
-
Reimplemented to handle state change and parent child relationships. Calling
`destroy` on a parent will cause the model to commit to the server
immediately. Calling destroy on a child relation will simply mark it for
deletion on the next save of the parent.
- Inherited From:
- Source:
Returns:
-
Type
-
Object
|
Boolean
-
fetch(Options) → {Object}
-
Parameters:
Name |
Type |
Description |
Options |
Object
|
|
- Inherited From:
- Source:
Returns:
Request
-
Type
-
Object
-
fetchId() → {Object}
-
Set the id on this record an id from the server. Including the `cascade`
option will call ids to be fetched recursively for `HasMany` relations.
- Inherited From:
- Source:
Returns:
Request
-
Type
-
Object
-
-
Retrieve related objects.
Parameters:
Name |
Type |
Description |
key |
String
|
The relation key to fetch models for. |
options |
Object
|
Options for 'Backbone.Model.fetch' and 'Backbone.sync'. |
update |
Boolean
|
Whether to force a fetch from the server (updating existing models). |
- Inherited From:
- Source:
Returns:
An array of request objects.
-
Type
-
Array
-
findOrCreate()
-
Overload: Need to handle status here
- Inherited From:
- Source:
-
-
Returns the current model prototype class.
- Inherited From:
- Source:
Returns:
-
Type
-
XM.Model
-
getParent(Get) → {XM.Model}
-
Return the parent model if one exists. If the `getRoot` parameter is
passed, it will return the top level parent of the model hierarchy.
Parameters:
Name |
Type |
Description |
Get |
Boolean
|
Root |
- Inherited From:
- Source:
Returns:
-
Type
-
XM.Model
-
initialize()
-
Called when model is instantiated.
- Inherited From:
- Source:
-
isReadOnly(attribute) → {Boolean}
-
Return whether the model is in a read-only state. If an attribute name
is passed, returns whether that attribute is read-only. It is also
capable of checking the read only status of child objects via a search path string.
// Inquire on the whole model
var readOnly = this.isReadOnly();
// Inquire on a single attribute
var readOnly = this.isReadOnly("name");
// Inquire using a search path
var readOnly = this.isReadOnly("contact.firstName");
Parameters:
Name |
Type |
Description |
attribute |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Boolean
-
obtainLock()
-
Attempt to obtain lock.
- Inherited From:
- Source:
Fires:
-
parse(Response)
-
Recursively checks the object against the schema and converts date strings to
date objects.
Parameters:
Name |
Type |
Description |
Response |
Object
|
|
- Inherited From:
- Source:
-
releaseLock()
-
Release lock.
- Inherited From:
- Source:
Fires:
-
renewLock()
-
Attempt to renew lock.
- Inherited From:
- Source:
Fires:
-
requiresDetail()
-
Used on inventory transaction models.
Default to false to ease printing handling of (inv. trans.) distribution detail.
- Inherited From:
- Source:
-
revert()
-
Revert a model back to its original state the last time it was fetched.
- Inherited From:
- Source:
-
revertStatus()
-
Revert the model to the previous status. Useful for reseting status
after a failed validation.
param {Boolean} - cascade
- Inherited From:
- Source:
-
save()
-
Reimplemented.
- Inherited From:
- Source:
-
set(Key, Value, Options)
-
Overload: Don't allow setting when model is in error or destroyed status, or
updating a `READY_CLEAN` record without update privileges.
Parameters:
Name |
Type |
Description |
Key |
String
|
Object
|
|
Value |
String
|
Object
|
or Options |
Options |
Objecw
|
|
- Inherited From:
- Source:
-
setStatus(Status)
-
Set the status on the model. Triggers `statusChange` event. Option set to
`cascade` will propagate status recursively to all HasMany children.
Parameters:
Name |
Type |
Description |
Status |
Number
|
|
- Inherited From:
- Source:
-
setValue()
-
Set a value(s) on attributes if key(s) is/are in schema, otherwise set on
`meta`. If `meta` is null then behaves the same as `setIfExists`.
Supports path strings.
- Inherited From:
- Source:
-
toJSON()
-
Overload: Delete objects marked as destroyed from arrays and
convert dates to strings.
Add support for 'includeNested' option that will
output JSON with nested toOne objects when specified.
- Inherited From:
- Source:
-
validate(Attributes, Options)
-
Default validation checks `attributes` for:
* Data type integrity.
* Required fields.
Returns `undefined` if the validation succeeded, or some value, usually
an error message, if it fails.
Parameters:
Name |
Type |
Description |
Attributes |
Object
|
|
Options |
Object
|
|
- Inherited From:
- Source: