JavaScript

{dialog.object}getChildObject Method

Syntax

{dialog.object}.getChildObject(alias [, componentType]);

Arguments

aliasstring

The alias of the child component. You must explicitly set the alias of the component to use this function.

componentTypestring

Default = 'ux'

The type of the component. Can be one of the following options:

Component Type
Meaning
'ux'

The child component is a UX Component. This is the default value.

'grid'

The child component is a Grid component.

'custom'

The child component is a Custom component. See About Custom Components to learn more about Custom components.

Returns

resultobjectboolean

Returns a pointer to the JavaScript object for the child component if the requested component exists. Otherwise, returns false.

Description

Returns a pointer to the child component.

Discussion

Gets a pointer to a component that has been opened as a child of the current UX component (for example, a component opened in a window or DIV), or embedded into the current us (using the Embedded Object control.) Once you have a pointer to the child object, you can execute methods on the child component.

//Get a pointer to the child UX component with alias of 'MYCHILD'.
var childObj = {dialog.object}.getChildObject('MYCHILD');

if (childObj) {
    // object exists
}

If the JavaScript object doesn't exist for the requested component, getChildObject() will return false. You should always check the returned value of the getChildObject() method before using the object. This can be done by wrapping your code in an if block as shown in the example.

Videos 

Getting a Pointer to a Parent or Child Component So You Can Call Methods of the Parent or Child Component

The ability to re-use components and open a child component in a window, div, TabbedUI pane, Panel, or embed into a parent component is one of the most powerful aspects of the Alpha Anywhere architecture.

When you open a component from a parent component, you will often want to get a pointer to the child component so you can manipulate it in your Javascript code in some way. For example, you might want some code in the parent component to read a control in the child, or set a value in the child. Similarly, you might want some code in the child component to read or set a control in its parent.

The .getParentObject() and .getChildObject() methods are used to get pointer to an object's parent or child objects.

In this video, we show how this is done.

Download Component