setTabIcon()
指定されたタブにアイコンを設定します。タブが指定されていない場合、アイコンは囲んでいるタブに設定されます。このメソッドを使って、タブのアイコンをカスタマイズします。このメソッドは、API バージョン 28.0 以降でのみ使用できます。
構文
1sforce.console.setTabIcon(iconUrl: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="testSetTabIcon();return false">
19 Click here to change the enclosing tab’s icon</A> <BR/>
20 <A HREF="#" onClick="testResetTabIcon(); return false;">
21 Click here to reset the enclosing tab’s icon</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 icon set successfully!');
28 } else {
29 alert('Tab icon cannot be set!');
30 }
31 }
32 function testSetTabIcon() {
33 sforce.console.setTabIcon('http://host/path/to/your/icon.png', null, checkResult);
34 }
35 function testResetTabIcon() {
36 sforce.console.setTabIcon(null, null, checkResult);
37 }
38 </script>
39</apex:page>応答
このメソッドは非同期であるため、コールバックメソッドのオブジェクトで応答を返します。応答オブジェクトには次の項目が含まれます。
| 名前 | 型 | 説明 |
|---|---|---|
| success | boolean | タブのアイコンの設定に成功した場合は true、タブのアイコンの設定に失敗した場合は false。 |