focusSidebarComponent()
ブラウザのサイドバーコンポーネントにフォーカスを移動します。このメソッドは、サイドバースタイルがタブまたはアコーディオンのコンポーネントにフォーカスを移動するために使用します。詳細は、Salesforce ヘルプの「コンソールコンポーネントのサイドバーのスタイル」を参照してください。このメソッドは、API バージョン 34.0 以降でのみ使用できます。
構文
1sforce.console.focusSidebarComponent(componentInfo:string (optional)tabId:string, callback:Function)引数
| 名前 | 型 | 説明 |
|---|---|---|
| componentInfo | string | フォーカスを移動するコンポーネントを表す JSON オブジェクト。この引数には、次のいずれかの形式を含める必要があります。 明確な型:
追加パラメータが必要な型:
|
| tabId | string | ブラウザのフォーカスを移動するタブの ID。 |
| callback | function | メソッドの完了時にコールされる JavaScript メソッド。 |
サンプルコード – 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 <apex:includeScript value="/support/console/34.0/integration.js"/>
19 <script type="text/javascript">
20
21 var callback = function (result) {}
22 if(result.success){
23 alert('Congratulations!');
24 }else{
25 alert('Something is wrong!');
26 }
27 };
28 function focusKnowledgeComponent() {
29 sforce.console.focusSidebarComponent(JSON.stringify({componentType:
30 'KNOWLEDGE_ONE'}),"scc-st-2", callback);
31 }
32 </script>
33 <A HREF="#" onClick="focusSidebarComponent(); return false">Focus Knowledge Component</A>
34</apex:page>応答
このメソッドは非同期であるため、コールバックメソッドのオブジェクトで応答を返します。応答オブジェクトには次の項目が含まれます。
| 名前 | 型 | 説明 |
|---|---|---|
| success | boolean | サイドバーコンポーネントにフォーカスが正常に移動された場合は true、それ以外の場合は false。 |