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.componentType


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.componentType.get()
skuid.componentType.getAll()
Returns:An array of strings describing all component types on a page by name of component type.
Return type:Array
skuid.componentType.list()
Return type:Array
skuid.componentType.map()
Return type:Object
skuid.componentType.register(typeName, typeDefinition)

Registers a Component Type with the given typeName. A registered Component Type acts like a constructor or initializer for that component.

Arguments:
  • typeName (string) – The name of the registered Component Type, e.g. “fieldeditor”, “barchart”, “calendar”
  • typeDefinition (function) –

    A function that “initializes” or “constructs” an instance of the component. The function has the following signature:

    function( element, xmlDefinition, component )

    • element (jQuery-wrapped DOM element): The root/parent element for the new Component. (This element may or may not be attached to the DOM.)
    • xmlDefinition (jQuery-wrapped JS XMLDoc):
    • component (skuid.component.Component): A Component instance for your typeDefinition function to interact with.

EXAMPLE:

1
2
skuid.componentType.register('pagebanner',function(element,xmlDefinition,component){
   element.html('Welcome: ' + xmlDefinition.attr('person'));
skuid.componentType.unregister()