RMP_TabPanel
new RMP_TabPanel(conf)
This constructor allows you to create a tab widget that can be inserted dynamically in your web interface.
Parameters:
| Name | Type | Description |
|---|---|---|
| conf | Object | JSON structure which contains the configuration of the tab |
Example
var tabConf = {
id: 'id_tab',
"first-tab":0,
tabs: [
{ visibleProp: 'true', activeProp: 'true', label: 'tab-1' },
{ visibleProp: 'true', activeProp: 'true', label: 'tab-2' }
]
};
const tab = new RMP_TabPanel(tabConf);
id_of_a_widget.insertBelow(tab);
Methods
getSelectedTabIndex() → {number}
Returns the index of the selected tab (index starts at '0').
Returns: number
getTabLabel(tabIndex) → {string}
Returns the name of the given tab.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') |
Returns: string
getType() → {string}
Returns the type of the widget (RMP_TabPanel).
Returns: string
getType() → {string}
Returns the type of the widget (RMP_TabPanel).
Returns: string
isTabActive(tabIndex) → {boolean}
Returns true if the tab is active, otherwise false.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') |
Returns: boolean
isTabVisible(tabIndex) → {boolean}
Returns true if the given tab is visible, otherwise false.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') |
Returns: boolean
setActiveTabRule(tabIndex, condCallback, listenedVariablesopt)
Sets the callback function that is to be executed to check whether the given tab is active or not.
Parameters:
| Name | Type | Description | Description | Description |
|---|---|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') | ||
| condCallback | module:RMP_TabPanel~callbackCondition | Callback that handles the tab active rule | ||
| listenedVariables | Array. |
[] | Variables that should be replaced by their values inside the condCallback script |
setOnclickScript(tabIndex, callBK)
Sets the callback function that is to be executed when the given tab is clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab |
| callBK | module:RMP_TabPanel~callbackFunction | Callback that handles the onClick script field |
setSelectedTabIndex(tabIndex)
Sets the given tab to selected.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') |
setTabActive(tabIndex, active)
Sets the given tab to active or inactive.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') |
| active | boolean | true: active, false: inactive |
setTabLabel(tabIndex, label)
Sets the name of the given tab.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') |
| label | string | Value (name) of the tab |
setTabVisible(tabIndex, visible)
Sets the given tab to visible or hidden.
Parameters:
| Name | Type | Description |
|---|---|---|
| tabIndex | number | Index of the tab (starts at '0') |
| visible | boolean | true: visible, false: invisible |
setVisibleTabRule(tabIndex, condCallback, listenedVariablesopt)
Sets the callback function that is to be executed to check whether the given tab is visible or not.
Parameters:
| Name | Type | Attributes | Default | Description |
|----------|----------|----------|
| tabIndex | number | | | Index of the tab (starts at '0') |
| condCallback | module:RMP_TabPanel~callbackCondition | | | Callback that handles the tab visible rule |
| listenedVariables | Array.condCallback script |
Type Definitions
callbackCondition() → {boolean}
Callback function to handle a rule condition (visible, active).
Returns: true if visible/active, otherwise false Type: boolean
callbackFunction()
Callback function to handle the onClick script field of a tab.