Working With Tab Panels

The tab panel, defined as a <tabs> element in an AXVW, is represented by the Ab.tabs.Tabs object in JavaScript. The tab panel is a panel, so it is accessed and auto-wired to the controller just like any other panel.

Each tab panel contains zero or more tab pages defined by a <tab> element in the AXVW. Each tab page can display either an external view (when the page defined in AXVW as <tab file="viewName.axvw"> or when the page is created dynamically) or one or more nested panels. Nested panel content is placed directly inside the tab DOM element. External view content is additionally wrapped inside an iframe element.

The tab panel can apply a "global" restriction to all tab pages. Any tab page can also have its own restriction that overrides the "global" one. Tab page restrictions are applied only to the "main" child panel (i.e. the first nested panel or the first panel defined in external view). The restriction must be an Ab.view.Restriction object.

See also: View-Level Security

Tab panel methods:

Method Description Parameters
show(visible) This is a standard panel method. With 2.0 views, the tab panel cannot be hidden, so this method does not do anything. visible : ignored
isWorkflowEnforced() Returns true if the tab workflow is enforced, as defined in AXVW.
isRefreshOnLoad() Returns true if all tab pages are refreshed when the view is loaded rather than when they are selected; or false if tab pages are refreshed whenever they are selected.
refresh(restriction)

This is a standard panel method. If the tab refresh policy is refreshOnLoad , the refresh() method refreshes all tab pages. If the tab refresh policy is refreshOnSelect (default in AXVW), the refresh() method refreshes only the currently selected tab page.

If the restriction parameter is specified, the restriction is set as "global" for all tab pages. However, tab pages that have individual restrictions (set using setTabRestriction() method) will ignore the "global" restriction.

restriction : Ab.view.Restriction object; global restriction for all tab pages (optional);
refreshTab( name) Refreshes the specified tab page. If the tab has its own restriction (set using setTabRestriction() method), it is applied. Otherwise, the "global" restriction is applied. name : tab name;
setTabRestriction( name, restriction) Sets a new restriction for the specified tab page, without refreshing it. Next tab page refresh will apply the restriction.

name : tab name;

restriction : Ab.view.Restriction object; restriction for specified tab page;

findTab(name) Returns the Ab.tabs.Tab object for the specified tab name (as defined in the AXVW), or null if the tab is not found. name : tab name;
selectTab( name, restriction, newRecord, clearRestriction, noRefresh) Selects and refreshes specified tab page.

name : tab name; this is the only required parameter;

restriction : new tab restriction (optional, default = keep old restriction);

newRecord : true to set the child edit form into new record mode (optional, default = false );

clearRestriction : true to clear the child panel restriction (optional, default = false );

noRefresh : true to suppress the tab page refresh (optional, default = false );

createTab( viewName, restriction, newRecord) Creates new dynamic tab page that displays external view content.

viewName : AXVW file name;

restriction : new tab restriction;

newRecord : true to set the child edit form into new record mode (optional, default = false );

enableTab(name, enabled) Enables or disables specified tab page.

name : tab name;

enabled : true to enable tab, false to disable it;

showTab(name, visible) Shows or hides specified tab page.

name : tab name;

visible : true to show tab, false to hide it;

getSelectedTabName() Returns the name of the currently selected tab page.


Tab panel events:

Event Description and parameters
beforeTabChange

Called after the user clicks on any tab, immediately before selecting the tab page. Parameters:

tabPanel : this tab panel reference;
currentTabName : name of the previously selected tab page;
newTabName : name of the tab page to be selected;

The event listener function may return false to veto the tab page change.

afterTabChange

Called after selecting any tab page. Parameters:

tabPanel : this tab panel reference;
selectedTabName : name of the selected tab page;

beforeTabClose

Called after the user clicks to close any dynamic tab, immediately before closing it. Parameters:

tabPanel : this tab panel reference;
tabName : name of the tab page to be closed;

The event listener function may return false to veto the tab page close.


Tab panel event listeners are auto-wired:

// this event listener is auto-wired due to naming convention
requestTabs_beforeTabChange: function(tabPanel, currentTabName, newTabName) {
...
}