Nigel1997 - #dev-help I'm having issues using...
# dev-help
n
#1143209464875462756 I'm having issues using primaryAction in conjunction with visibleActions - specifically, if I try and use primaryAction: Action.Download Essentially, I am using visibleActions to only show elements I am happy to display, and my list is limited to only download options: primaryAction: Action.Download, // visibleActions: [], // The above works, but no control over visable elements primaryAction: Action.Download, visibleActions: [ Action.Download, Action.DownloadAsCSV, Action.DownloadAsXLSX, Action.DownloadAsPng ], // The above displays the download PrimaryAction button, but it does not function. Any thoughts?
a
message has been deleted
s
Solution:
primaryAction
and
visibleActions
do different things, and they are not interchangeable. -
primaryAction
promotes an existing action to the primary button on Liveboard visualizations. -
visibleActions
is an allowlist. If it is empty, no actions appear. - For nested menus, you must include the parent action and the child action(s) in
visibleActions
. So for download-related actions: -
Action.Download
= the Download parent menu action -
Action.DownloadAsCsv
,
Action.DownloadAsXlsx
,
Action.DownloadAsPng
,
Action.DownloadAsPdf
= child actions That means these cases behave like this:
Copy code
js
primaryAction: Action.Download,
visibleActions: [],
This will not work the way you want, because
visibleActions: []
hides all actions.
Copy code
js
primaryAction: Action.Download,
visibleActions: [
  Action.Download,
  Action.DownloadAsCsv,
  Action.DownloadAsXlsx,
  Action.DownloadAsPng,
],
This is the correct pattern if you want only download options visible.
Action.Download
must be present because it is the parent menu action. Use:
Copy code
js
import { init, LiveboardEmbed, AuthType, Action } from '@thoughtspot/visual-embed-sdk';

init({
  thoughtSpotHost: 'https://your-instance.thoughtspot.cloud',
  authType: AuthType.None,
});

const embed = new LiveboardEmbed('#ts-embed', {
  liveboardId: '<LIVEBOARD_ID>',
  primaryAction: Action.Download,
  visibleActions: [
    Action.Download,
    Action.DownloadAsCsv,
    Action.DownloadAsXlsx,
    Action.DownloadAsPng,
  ],
});

embed.render();
Also, if you want only a specific nested download option, include both parent + child:
Copy code
js
visibleActions: [Action.Download, Action.DownloadAsPdf]
Suggestions: - If
primaryAction: Action.Download
still doesn’t show as expected, check whether that action is being blocked elsewhere by
hiddenActions
or
disabledActions
. The docs explicitly say the chosen primary action must not be hidden or disabled.
- Make sure your enum names match the SDK exactly: -
Action.DownloadAsCsv
-
Action.DownloadAsXlsx
-
Action.DownloadAsPng
-
primaryAction
does not remove the default action entirely; it replaces the primary button, and the previous default action moves into the
...
menu. - If your goal is “download only, nothing else,”
visibleActions
should be your main control, with
primaryAction
just choosing which of those appears as the promoted button. Docs: - Action enum: https://developers.thoughtspot.com/docs/Enumeration_Action - Action configuration / visibleActions: https://developers.thoughtspot.com/docs/action-config#_visible_actions - Override default primary actions: https://developers.thoughtspot.com/docs/action-config#_override_default_primary_actions