extensions namespace is the namespace for Tableau extensions. A dashboard extension is one type of extension. A dashboard extension has access to the dashboardContent namespace, and all of the objects and classes of the dashboard. Some namespaces, like the settings, environment, and ui are available to all extensions.extensions namespace is the namespace for Tableau extensions. A dashboard extension is one type of extension. A dashboard extension has access to the dashboardContent namespace, and all the objects and classes of the dashboard. Some namespaces, like the settings, environment, and ui are available to all extensions.
The following diagram shows the relationship between the extensions namespace and the worksheets in @@ -198,6 +198,9 @@
An event which is raised when the dialog has a message for the underlying extension (sent using tableau.extensions.ui.sendDialogMessageAsync), or vice versa.
+ Should be listened for directly from the tableau.extensions.ui object.
+ For example, when the dialog sends a message to the extension using tableau.extensions.ui.sendDialogMessageAsync method,
+ the extension should be listening for this event and handling it.
The closeDialog method must be called from extension running in the popup dialog window.
Closes the extension's dialog. Can be called from the popup dialog or from the extension itself.
A message to send.
+The url of the dialog to send the message to. If not provided, the message will be sent to the parent extension.
+
+ // Sending a message from the dialog to the extension:
+
+ // extension code (listening for messages originating from the dialog)
+ tableau.extensions.ui.addEventListener(tableau.TableauEventType.DialogMessageReceived, (e) => {
+ console.log('Message received from dialog: ' + e.message);
+ })
+ tableau.extensions.ui.displayDialogAsync(popupUrl);
+ ...
+
+ // dialog code (sending message to extension)
+ await tableau.extensions.initializeDialogAsync();
+ await tableau.extensions.ui.sendDialogMessageAsync('Hello from dialog!');
+
+
+ // Sending a message from the extension to the dialog:
+
+ // dialog code (listening for messages originating from the extension)
+ await tableau.extensions.initializeDialogAsync();
+ tableau.extensions.ui.addEventListener(tableau.TableauEventType.DialogMessageReceived, (e) => {
+ console.log('Message received from extension: ' + e.message);
+ })
+ ...
+
+ // extension code (sending message to dialog)
+ tableau.extensions.ui.displayDialogAsync(popupUrl);
+ // waiting a bit for dialog to appear before sending message.
+ // notice the intentional omission of await in calls to displayDialogAsync.
+ // that's because if we await, we wont run any code after that line until the dialog closes and the promise returns.
+ setTimeout(() => tableau.extensions.ui.sendDialogMessageAsync('Hello from extension!', popupUrl), 1000);
+
+- experimental
+
+
+Raised when a message is received that was sent by a dialog or extension via
+sendDialogMessageAsync.