Newer Version Available
disableTabClose()
Prevents a user from closing a tab or a subtab.
If the ID parameter doesn’t specify a tab, the enclosing tab is used. You can also use
this method to re-enable a tab that has been disabled. Available in API version 42.0 or later.
Syntax
Arguments
| Name | Type | Description |
|---|---|---|
| disable | boolean | Specifies whether to disable the tab. If true, the user can’t close the tab. If false, the user can close the tab. |
| tabId | string | The tabId for the tab to enable or disable. Use false to automatically select the enclosing tab or subtab without needing to specify a tabId. The enclosing tabId can’t be inferred when this call is made from outside a sidebar component. For example, if you call this method from a footer widget, specify the tabId. If the tabId is for a “Details” subtab of a primary tab, the primary tabId is used instead. |
| callback | function | JavaScript method that’s called upon completion of the method. The callback is passed a response object. See response information below. |
Sample Code–Visualforce
Response
This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following fields:
| Name | Type | Description |
|---|---|---|
| success | boolean | true if the action completed successfully, false otherwise. |
| message | string | If the action completed successfully, message contains the affected tabId. If the action failed, message contains the error message. |