setTabStyle()
指定のタブにカスケードスタイルシート (CSS) を設定します。タブが指定されていない場合、CSS は囲んでいるタブに設定されます。このメソッドを使って、タブのデザインをカスタマイズします。このメソッドは、API バージョン 28.0 以降でのみ使用できます。
構文
1sforce.console.setTabStyle(style:String, tabId:String, (optional)callback:Function)引数
サンプルコード – Visualforce
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page>
18 <A HREF="#" onClick="testSetTabStyle();return false">
19 Click here to change the enclosing tab’s background color to red</A> <BR/>
20 <A HREF="#" onClick="testResetTabStyle(); return false;">
21 Click here to reset the enclosing tab’s style</A>
22
23 <apex:includeScript value="/support/console/28.0/integration.js"/>
24 <script type="text/javascript">
25 function checkResult(result) {
26 if (result.success) {
27 alert('Tab style set successfully!');
28 } else {
29 alert('Tab style cannot be set!');
30 }
31 }
32 function testSetTabStyle() {
33 sforce.console.setTabStyle('background:red;', null, checkResult);
34 }
35 function testResetTabStyle() {
36 sforce.console.setTabStyle(null, null, checkResult);
37 }
38 </script>
39</apex:page>応答
このメソッドは非同期であるため、コールバックメソッドのオブジェクトで応答を返します。応答オブジェクトには次の項目が含まれます。
| 名前 | 型 | 説明 |
|---|---|---|
| success | boolean | タブのスタイルの設定に成功した場合は true、タブのスタイルの設定に失敗した場合は false。 |