skuid.model¶
Good news, everyone!
We are currently writing more material for our Javascript API. All of the objects and functions you see below are part of Skuid’s public API, even if they aren’t fully documented yet. Feel free to experiment while we write about them—and check back later for updates.
-
skuid.model.
Condition
()¶ Properties:
-
skuid.model.skuid.model.Condition.
inactive
¶ boolean
Read-only. A value indicating if the Condition is inactive - meaning it will not be applied to the Model. The default value is defined in the Page Composer, but inactive Conditions can be activated via a skuid.model.Model’s activateCondition function. Likewise, an active Condition may be deactivated via the deactivateCondition function.
-
skuid.model.skuid.model.Condition.skuid.model.Condition.
value
¶
string
For a Condition with the Value Content set to “Single specified value”, a value defined in the Page Composer to which the Condition’s field will be compared. This value can be changed at run-time (and the Condition reapplied) to enable dynamic Model filtering.
-
skuid.model.Condition.
values
¶
string [ ]
For a Condition with the Value Content set to “Multiple specified values”, an array of values defined in the Page Composer to which the Condition’s field will be compared. This value can be changed at run-time (and the Condition reapplied) to enable dynamic Model filtering.
-
skuid.model.Condition.
field
¶
string
The API name of the field that this condition will affect.
-
-
-
skuid.model.
Field
()¶
-
skuid.model.
Model
()¶
-
skuid.model.
cancel
()¶
-
skuid.model.
getModel
(modelId)¶ Returns the
skuid.model.Model
registered under the given id.Shortcut: skuid.$M()
Arguments: - modelId (string) – The Id of a Model, as defined in the Page Composer.
Returns: The model associated with the given modelId, or undefined if the modelId is not recognized.
Return type:
-
skuid.model.
getModelsByService
()¶ Displays a list of models by which data source they are associated with.
Returns: An object containing an array for each data source represented on the page, with all models associated with a data source listed in the respective array. Return type: Object
-
skuid.model.
getModelsList
()¶ Displays the
skuid.model.Model
for all models on a page.Returns: A list of Skuid models on a page. Return type: Array
-
skuid.model.
getMoreData
()¶
-
skuid.model.
isNewId
(id)¶ Arguments: - id (string) – An Id from a row object
Return type: boolean
-
skuid.model.
list
()¶ Returns: Returns all registered models on the page. The order of the models is not guaranteed. Return type: skuid.model.Model[]
-
skuid.model.
load
()¶
-
skuid.model.
map
()¶ Returns: A simple object map of Model Ids (as properties) to Models (as values of those properties). Return type: Object 1 2 3
{ <Model Id> : <skuid.model.Model> }
-
skuid.model.
save
(models, options)¶ Sends all changes for the given models to the server.
Arguments: - models (skuid.model.Model[]) – The array of Models from which to send changes to the server.
- options (object) –
A simple object with the following properties:
- callback (function ( result )): A function, accepting one argument. Skuid will call this function when the save operation is complete and will pass it an object with the following properties:
- totalsuccess (boolean): Indicates if all requested operations succeeded, for all rows.
- insertResults (object [ ]): Result objects for all rows that Skuid attempted to insert.
- updateResults (object [ ]): Result objects for all rows that Skuid attempted to update.
- deleteResults (object [ ]): Result objects for all rows that Skuid attempted to delete.
- rollbackOnAnyError (boolean): A boolean set to false by default. If set to true, this will rollback any changes made before the error occurred in the save process. This prevents data synchronization issues when a new record (or a partial edit of a record) causes new data to mix with old.
Note
At this time, rollbackOnAnyError is only supported by Salesforce.
- callback (function ( result )): A function, accepting one argument. Skuid will call this function when the save operation is complete and will pass it an object with the following properties:
Returns: The Promise object will be resolved upon completion of the save operation.
Return type:
-
skuid.model.
updateData
(models, callback)¶ Updates (or “refreshes”) the specified Models with the most up-to-date data from the server.
Arguments: - models (skuid.model.Model[]) – The array of Models to receive updates from the server
- callback (function()) – Called by skuid after the update operation has completed
Returns: The Promise object will be resolved upon completion of the update operation.
Return type: