Class \Prado\Web\UI\WebControls\TTabPanel
TTabPanel displays a tabbed panel. Users can click on the tab bar to switching among different tab views. Each tab view is an independent panel that can contain arbitrary content.
If the \Prado\Web\UI\WebControls\setAutoSwitch property is enabled, the user will be able to switch the active view to another one just hovering its corresponding tab caption.
A TTabPanel control consists of one or several TTabView controls representing the possible tab views. At any time, only one tab view is visible (active), which is specified by any of the following properties:
- \Prado\Web\UI\WebControls\setActiveViewIndex - the zero-based integer index of the view in the view collection.
- \Prado\Web\UI\WebControls\setActiveViewID - the text ID of the visible view.
- \Prado\Web\UI\WebControls\setActiveView - the visible view instance. If both \Prado\Web\UI\WebControls\setActiveViewIndex and \Prado\Web\UI\WebControls\setActiveViewID are set, the latter takes precedence.
TTabPanel uses CSS to specify the appearance of the tab bar and panel. By default, an embedded CSS file will be published which contains the default CSS for TTabPanel. You may also use your own CSS file by specifying the \Prado\Web\UI\WebControls\setCssUrl property. The following properties specify the CSS classes used for elements in a TTabPanel:
- \Prado\Web\UI\WebControls\setCssClass - the CSS class name for the outer-most div element (defaults to 'tab-panel');
- \Prado\Web\UI\WebControls\setTabCssClass - the CSS class name for nonactive tab div elements (defaults to 'tab-normal');
- \Prado\Web\UI\WebControls\setActiveTabCssClass - the CSS class name for the active tab div element (defaults to 'tab-active');
- \Prado\Web\UI\WebControls\setViewCssClass - the CSS class for the div element enclosing view content (defaults to 'tab-view');
To use TTabPanel, write a template like following:
<com:TTabPanel>
<com:TTabView Caption="View 1">
content for view 1
</com:TTabView>
<com:TTabView Caption="View 2">
content for view 2
</com:TTabView>
<com:TTabView Caption="View 3">
content for view 3
</com:TTabView>
</com:TTabPanel>
Class hierarchy
- \Prado\Web\UI\WebControls\TTabPanel implements IPostBackDataHandler
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.1.1
public
|
addParsedObject(mixed $object) : mixed
Adds object parsed from template to the control.
This method adds only TTabView objects into the \Prado\Web\UI\WebControls\getViews collection. All other objects are ignored. |
public
|
|
public
|
|
public
|
getActiveView() : TTabView
Returns the currently active view.
This method will examin the ActiveViewID, ActiveViewIndex and Views collection to determine which view is currently active. It will update ActiveViewID and ActiveViewIndex accordingly. |
public
|
getActiveViewID() : string
Returns the ID of the active tab view.
Note, this property may not return the correct ID. To ensure the correctness, call getActiveView() first. |
public
|
getActiveViewIndex() : int
Returns the index of the active tab view.
Note, this property may not return the correct index. To ensure the correctness, call getActiveView() first. |
public
|
|
public
|
|
public
|
|
public
|
getDataChanged() : bool
Returns a value indicating whether postback has caused the control data change.
This method is required by the \Prado\Web\UI\IPostBackDataHandler interface. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
loadPostData(string $key, array<string|int, mixed> $values) : bool
Loads user input data.
This method is primarly used by framework developers. |
public
|
onPreRender(mixed $param) : mixed
Registers CSS and JS.
This method is invoked right before the control rendering, if the control is visible. |
public
|
raisePostDataChangedEvent() : mixed
Raises postdata changed event.
This method is required by IPostBackDataHandler interface. It is invoked by the framework when \Prado\Web\UI\WebControls\getActiveViewIndex property is changed on postback. This method is primarly used by framework developers. |
public
|
render(mixed $writer) : mixed
Renders the control.
This method overrides the parent implementation by replacing it with the following sequence:
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
activateView(TTabView $view) : mixed
Activates the specified view.
If there is any other view currently active, it will be deactivated. |
protected
|
|
protected
|
createControlCollection() : TTabViewCollection
Creates a control collection object that is to be used to hold child controls
|
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing postback for this control.
This method overrides the parent implementation. |
protected
|
|
protected
|
|
protected
|
|
protected
|
registerStyleSheet() : mixed
Registers the CSS relevant to the TTabControl.
It will register the CSS file specified by \Prado\Web\UI\WebControls\getCssUrl. If that is not set, it will use the default CSS. |