bpmext.ui.View
Contains view specific helper functions
Methods:
getParent(literal)
Returns:
{bpmext.ui.View}
Retrieve parent view, or undefined if no parent exists
Name | Type | Default | Description |
literal | {boolean} | Return the literal parent (which may be a visual-only section) of this control |
Example
ChildView1.ui.getParent(); //Returns reference to the view containing ChildView1 |
isSubscribingToEvent(eventName)
Returns:
{boolean}
Tests if a view subscribes to an event, returns true if addEventSubscription() was called previously with the given <eventName>
Name | Type | Default | Description |
eventName | {string} | Name of event for which to test the subscription |
Example
var subFlag = MyView.isSubscribingToEvent("MY_EVENT1"); |
getChild(name, index)
Returns:
{bpmext.ui.View}
Retrieve immediate child control
Name | Type | Default | Description |
name | {string} | Name of a control that is an immediate literal child of this control | |
index | {integer} | Index of child control (if the child control is repeating) |
Example
ChildView1.ui.getChild("Text1"); //Returns reference to the child named Text1 |
getAncestor(name, literal)
Returns:
{bpmext.ui.View}
Retrieve ancestor view
Name | Type | Default | Description |
name | {string} | Return a control in the ancestor chain of this control matching the name specified | |
literal | {boolean} | Searches the literal ancestor(s) (which may be a visual-only section) of this control |
Example
ChildView1.ui.getAncestor("AncestorView1"); //Returns reference to the ancestor named AncestorView1 |
getOption(optionName, defVal)
Returns:
{ANY}
Retrieves the configuration option value - or the default value if the option is not set
Name | Type | Default | Description |
optionName | {string} | The name of the configuration option for the view | |
defVal | {ANY} | (Optional) The default value to return if the option is not set |
Example
var prop1 = MyView.ui.getOption("prop1", "D"); //Return the value of MyView.context.options.prop1, or "D" if |
publishEvent(eventName, payload)
Publishes the named event. Triggers the execution of the callback functions for each respective subscriber to the event.
Name | Type | Default | Description |
eventName | {string} | Name of event to be published | |
payload | {Object} | Additional (optional) data to send to event subscribers |
Example
MyView.publishEvent("MY_EVENT1", "My test data"); |
getSibling(name)
Returns:
{bpmext.ui.View}
Retrieve sibling view
Name | Type | Default | Description |
name | {string} | Return a control on the same addressing level as this control |
Example
ChildView1.ui.getSibling("OtherView1"); //Returns reference to the sibling named OtherView1 |
removeEventSubscription(eventName)
Unsubscribes from notifications from the named event.
Name | Type | Default | Description |
eventName | {string} | Name of event previously registered |
Example
MyView.removeEventSubscription("MY_EVENT1"); |
get(path, index)
Returns:
{bpmext.ui.View}
Retrieve child view
Name | Type | Default | Description |
path | {string} | Path to the view (start path with / for absolute addressing) | |
index | {number} | Index of the child view if the path refers to an array of views |
Example
MyView.ui.get("ChildView1/Text1") |
addEventSubscription(eventName, callbackFunction)
Registers a callback function with an event name. When the event is broadcast with
publishEvent
, the callback function will be called.Name | Type | Default | Description |
eventName | {string} | Name of event associated with the callback function | |
callbackFunction | {function} | Reference to the callback function |
Example
//alert displayed when publishEvent("MY_EVENT1", "test data") is called
MyView.addEventSubscription("MY_EVENT1", function(){alert("Event triggered!");}); |
getAbsoluteName(path)
Returns:
{string}
Retrieve the fully-qualified path to the view (starting for the top of the view tree)
Name | Type | Default | Description |
path | {string} | Relative path to the view |
Example
MyView.ui.getAbsoluteName("ChildView1/Select2"); //returns /ViewA/ChildView1/Select2 |
invoke(functionName, args)
Returns:
{ANY}
Invoke a function on the view or its ancestor chain
Name | Type | Default | Description |
functionName | {string} | Name of the function to invoke | |
args | {...ANY} | 0 or more arguments passed to the function (up to 9 total) |
Example
me.ui.invoke("multiply", 34, 87); |
getCount(path)
Returns:
{number}
Retrieve the number of child views for a given path (without using the [index] notation)
Name | Type | Default | Description |
path | {string} | Path to the view array (start path with / for absolute addressing) |
Example
MyView.ui.getCount("ChildView1/Table1/Text1") |
getIndex()
Returns:
{number}
Retrieve the index of this view (assuming it is in a repeating container). Note that this is not necessarily the index of the item in the data that is backing the repeating view. In fact, using this method on two different views from the same repeating entry could give different values.
Example
alert("Index of this control: " + me.ui.getIndex()); |