Newer Version Available
setTabStyle()
Sets a cascading style sheet (CSS) on the specified tab. If
a tab is not specified, the CSS is set on the enclosing tab. Use this method to
customize a tab’s look and feel. This method is only available in API
version 28.0 or later.
Syntax
1sforce.console.setTabStyle(style:String, tabId:String, (optional)callback:Function)Arguments
Sample Code–Visualforce
1<apex:page>
2 <A HREF="#" onClick="testSetTabStyle();return false">
3 Click here to change the enclosing tab’s background color to red</A> <BR/>
4 <A HREF="#" onClick="testResetTabStyle(); return false;">
5 Click here to reset the enclosing tab’s style</A>
6
7 <apex:includeScript value="/support/console/48.0/integration.js"/>
8 <script type="text/javascript">
9 function checkResult(result) {
10 if (result.success) {
11 alert('Tab style set successfully!');
12 } else {
13 alert('Tab style cannot be set!');
14 }
15 }
16 function testSetTabStyle() {
17 sforce.console.setTabStyle('background:red;', null, checkResult);
18 }
19 function testResetTabStyle() {
20 sforce.console.setTabStyle(null, null, checkResult);
21 }
22 </script>
23</apex:page>Response
This method is asynchronous, so it returns its response in an object in a callback method. The response object contains the following field:
| Name | Type | Description |
|---|---|---|
| success | boolean | true if setting the tab’s style was successful, false if setting the tab’s style wasn’t successful. |