JavaScript

{dialog.object}getPanelObject Method

Syntax

var panelObject = {dialog.object}.getPanelObject();

Returns

panelObjectA5.PanelLayoutA5.PanelNavigatorundefined

Returns the panel object if the panel exists. Depending on how your application is built, the panel object will be either a A5.PanelLayout or A5.PanelNavigator. If the panel does not exist, getPanelObject() will return undefined.

Description

If the UX component use Panels, gets a pointer to the Panel object. Once you have a pointer to the Panel Object you can call methods of the Panel Object (such as .getState() and .setState()).

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

Example: Getting the Panel Object State 

//Get a pointer to the Panel Object
var pnObj = {dialog.object}.getPanelObject();

if (pnObj) {
    //Get the current state of the Panel Object
    var state = pnObj.getState();

    //See what's in the 'state' object
    alert($u.o.toJSON(pnObj.getState());
}

Example: Setting the Panel Object State 

//Get a pointer to the Panel Object
var pnObj = {dialog.object}.getPanelObject();

if (pnObj) {
    //Restore the state of the Panel Object. (Assume that the state is in a variable called 'state')
    pnObj.setState(state);
}

Storing and Restoring the 'state' of a UX Component with Multiple Panels

UX Components can use complex layouts that involve multiple Panel Cards inside Panel Navigators and Panel Layouts. You might want to persist the state of the Panel (i.e. remember which Panel Card in a particular Panel Navigator is active and which Panels in a Panel Navigator have been docked) so that you can later restore this state. This video shows how this can be done.

Download Component

2013-08-19

See Also