Working With Tab Panels
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
If the
|
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. |
|
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. |
|
createTab( viewName, restriction, newRecord) | Creates new dynamic tab page that displays external view content. |
|
enableTab(name, enabled) | Enables or disables specified tab page. |
|
showTab(name, visible) | Shows or hides specified tab page. |
|
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:
The event listener function may return
|
afterTabChange |
Called after selecting any tab page. Parameters:
|
beforeTabClose |
Called after the user clicks to close any dynamic tab, immediately before closing it. Parameters:
The event listener function may return
|
Tab panel event listeners are auto-wired:
// this event listener is auto-wired due to naming convention
requestTabs_beforeTabChange: function(tabPanel, currentTabName, newTabName) {
...
}