You need to sign in to do that
Don't have an account?
louisa barrett 7
Lightning Console close workspace and sub tabs
Does anyone know how to close a workspace(primary) tab and it's sub tabs?
The below only returns the subtab. I need to close the primary and any subtabs.
The below only returns the subtab. I need to close the primary and any subtabs.
var workspaceAPI = component.find("workspace"); workspaceAPI.getEnclosingTabId().then(function(tabId) { var enclosingTabId = tabId; workspaceAPI.closeTab({tabId: enclosingTabId}); })Many thanks
Greetings to you!
Please refer to the below links which might help you further with the above requirement.
https://ericsplayground.wordpress.com/2018/08/11/close-all-tabs-in-a-lightning-console/
https://github.com/ericrsmith35/Lightning-Components/tree/master/src/aura/ersCloseConsoleTabs
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Thank you for the response, but that is using the .getAllTabsInfo method and closing all the tabs regardless of whether they are workspace or subtabs. I need to find the workspace ID of the currently focused subtab. In Classic there was a specific method for this .getEnclosingPrimaryTabId, but I cannot see any equivilent method to that in the WorkspaceAPI
Thanks
Component:
Controller:
I hope it helps you.
Regards,
Khan Anas
I can't focus the workspace tab and then call that methosd, as I cannot find a way to get the ID for it in the first place.