Note

All code samples below refer to the skuid object.

In the v2 API, this object is not directly accessible when working within a browser console—or when referring to another Skuid page runtime.

If you are experiencing issues, use the skuid.runtime API to target the appropriate page context.

skuid.label

skuid.label.add()

Registers an additional Custom Label with Skuid

skuid.label.getAll()

Returns a JavaScript object containing as its keys the names of all Labels registered with Skuid, and as its values, the content of the Labels. Use this if you’re trying to inspect which Labels are available for use.

Returns:Names of all Labels registered with Skuid
Return type:Object
skuid.label.map()

Returns all registered Custom Labels keyed by API Name

skuid.label.merge(template[, merge1, ..., mergeN])

Takes a text string containing incrementally-numbered, single-brace wrapped merges (e.g. {0} {1} {2} ) and uses any additional arguments to populate these merges.

Arguments:
  • template (string) – A string containing one or more merges, e.g. “Hello {0} {1}, welcome to Skuid!”
  • merge1, ..., mergeN (string) – One or more strings to merge in to the template, e.g. “Kip”, “Thorne”
Returns:

The string result of populating all merges in the template with the arguments provided.

Return type:

string

EXAMPLE:

1
2
3
4
5
6
7
8
9
var message = "Hello {0} {1}, welcome to Skuid!";

var firstName = "Kip";

var lastName = "Thorne";

var result = skuid.label.merge(message,firstName,lastName);

// result ===> "Hello Kip Thorne, welcome to Skuid!"
skuid.label.parse()
skuid.label.read(labelName, defaultValue)

Returns the custom label, by API name, named labelName, (optionally) returning defaultValue if no such label exists

Arguments:
  • labelName (string) – The name of the label
  • defaultValue (string) – A value to return if the label name is not recognized can be found
Returns:

The custom label associated with the given labelName. If no custom label is associated with the name, then defaultValue if provided. Otherwise, a zero-length string. This function will never return a null or undefined value.

Return type:

string

SHORTCUTS:

skuid.$L(labelName) can also be used in lieu of skuid.label.read(labelName).