focusSidebarComponent()
Focuses the browser on a sidebar component. Use
this method to focus on a component with the tab or accordion sidebar style.
Syntax
sforce.console.focusSidebarComponent(componentInfo:string (optional)tabId:string, callback:Function)
Arguments
Name | Type | Description |
---|---|---|
componentInfo | string | The JSON object that represents the component to focus on. This
argument must include one of the following forms: Unambiguous types:
Types that require additional parameters:
|
tabId | string | The ID of the tab on which to focus the browser. |
callback | function | JavaScript method that’s called upon completion of the method. |
Sample Code–Visualforce
<apex:page>
<apex:includeScript value="/support/console/64.0/integration.js"/>
<script type="text/javascript">
var callback = function (result) {}
if(result.success){
alert('Congratulations!');
}else{
alert('Something is wrong!');
}
};
function focusKnowledgeComponent() {
sforce.console.focusSidebarComponent(JSON.stringify({componentType:
'KNOWLEDGE_ONE'}),"scc-st-2", callback);
}
</script>
<A HREF="#" onClick="focusSidebarComponent(); return false">Focus Knowledge Component</A>
</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 focusing the sidebar component was successful; false otherwise. |