new bpmext.ui.View()
Convenience view object used to add bpmext.ui function shortcuts on view objects. This constructor is never used explicitly.
Methods
-
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 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!");});
-
get(path, index){bpmext.ui.View}
-
Retrieve child view
Name Type 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 Returns:
Type Description bpmext.ui.View Example
MyView.ui.get("ChildView1/Text1")
-
getAbsoluteName(path){string}
-
Retrieve the fully-qualified path to the view (starting for the top of the view tree)
Name Type Description path
string Relative path to the view Returns:
Type Description string Example
MyView.ui.getAbsoluteName("ChildView1/Select2"); //returns /ViewA/ChildView1/Select2
-
getAncestor(name, literal){bpmext.ui.View}
-
Retrieve ancestor view
Name Type 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 Returns:
Type Description bpmext.ui.View The reference to the ancestor or undefined if no ancestor exists Example
ChildView1.ui.getAncestor("AncestorView1"); //Returns reference to the ancestor named AncestorView1
-
getChild(name, index){bpmext.ui.View}
-
Retrieve immediate child control
Name Type 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) Returns:
Type Description bpmext.ui.View The reference to the child control or undefined if no child matching the name exists Example
ChildView1.ui.getChild("Text1"); //Returns reference to the child named Text1
-
getCount(path){number}
-
Retrieve the number of child views for a given path (without using the [index] notation)
Name Type Description path
string Path to the view array (start path with / for absolute addressing) Returns:
Type Description number Example
MyView.ui.getCount("ChildView1/Table1/Text1")
-
getIndex(){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.
Returns:
Type Description number Example
alert("Index of this control: " + me.ui.getIndex());
-
getOption(optionName, defVal){ANY}
-
Retrieves the configuration option value - or the default value if the option is not set
Name Type 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 Returns:
Type Description ANY The value of the option if set, or the default value if specified, otherwise undefined Example
var prop1 = MyView.ui.getOption("prop1", "D"); //Return the value of MyView.context.options.prop1, or "D" if
.context.options.prop1 is not set -
getParent(literal){bpmext.ui.View}
-
Retrieve parent view, or undefined if no parent exists
Name Type Description literal
boolean Return the literal parent (which may be a visual-only section) of this control Returns:
Type Description bpmext.ui.View Example
ChildView1.ui.getParent(); //Returns reference to the view containing ChildView1
-
getSibling(name){bpmext.ui.View}
-
Retrieve sibling view
Name Type Description name
string Return a control on the same addressing level as this control Returns:
Type Description bpmext.ui.View The reference to the sibling or null if no sibling matching the name exists Example
ChildView1.ui.getSibling("OtherView1"); //Returns reference to the sibling named OtherView1
-
invoke(functionName, args){ANY}
-
Invoke a function on the view or its ancestor chain
Name Type Description functionName
string Name of the function to invoke args
ANY repeatable 0 or more arguments passed to the function (up to 9 total) Returns:
Type Description ANY Whatever the function returns Example
me.ui.invoke("multiply", 34, 87);
-
isSubscribingToEvent(eventName){boolean}
-
Tests if a view subscribes to an event, returns true if addEventSubscription() was called previously with the given <eventName>
Name Type Description eventName
string Name of event for which to test the subscription Returns:
Type Description boolean Example
var subFlag = MyView.isSubscribingToEvent("MY_EVENT1");
-
publishEvent(eventName, payload)
-
Publishes the named event. Triggers the execution of the callback functions for each respective subscriber to the event.
Name Type 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");
-
removeEventSubscription(eventName)
-
Unsubscribes from notifications from the named event.
Name Type Description eventName
string Name of event previously registered Example
MyView.removeEventSubscription("MY_EVENT1");