Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Extensions

The extension namespace contains all functionality available to Extensions in Tableau.

Hierarchy

  • Extensions

Index

All Extensions Properties

Dashboard Extensions Properties

Viz Extensions Properties

All Extensions Methods

Dashboard Extensions Methods

All Extensions Properties

environment

environment: Environment

The environment namespace provides methods to programmatically gather information about the environment in which the extension is running. To access the objects in this name space, specify tableau.extensions.environment.

settings

settings: Settings

The settings namespace provides methods to get and set values which will be persisted in a workbook. You can use the settings to configure an extension. To access the objects in this name space, specify tableau.extensions.settings.

ui

ui: UI

The ui namespace provides methods for an extension to display a popup dialog window. To access the objects in this name space, specify tableau.extensions.ui.

workbook

workbook: Workbook

The currently opened workbook.

since

1.6.0 and Tableau 2021.3

Dashboard Extensions Properties

Optional dashboardContent

dashboardContent: DashboardContent

The dashboardContent namespace provides access to the dashboard object when the extension is a dashboard extension. When you have the dashboard object, you have access to all elements in the dashboard including the worksheets, marks, filters, parameters, and data sources. To access the objects in this name space, specify tableau.extensions.dashboardContent.

dashboardObjectId

dashboardObjectId: number

The dashboard object id for the extension that is running.

since

1.7.0

Viz Extensions Properties

Optional worksheetContent

worksheetContent: WorksheetContent

The worksheetContent namespace provides access to the worksheet when the extension is a worksheet extension. When you have the worksheet object, you have access to all elements in the worksheet To access the objects in this name space, specify tableau.extensions.worksheetContent.

beta

All Extensions Methods

createVizImageAsync

  • createVizImageAsync(inputSpec: object): Promise<string>
  • since

    1.8.0 and Tableau 2021.4

    For additional information on using the createVizImageAsync method, see Add Tableau Viz to Your Dashboard Extensions.

    For additional information about setting options in the inputSpec object, see Tableau Viz Reference.

    Parameters

    • inputSpec: object

      the object containing the embedded data and visual spec details

         tableau.extensions.createVizImageAsync(myInputSpec));

      The following is an example of an input spec object.

      var myInputSpec = {
            description: 'A simple bar chart with embedded data.',
            data: {
                values: [
                    { Category: 'A', Measure: 28, Weather: 10 },
                    { Category: 'B', Measure: 55, Weather: 9 },
                    { Category: 'C', Measure: 43, Weather: 8 },
                ]
            },
            mark: tableau.MarkType.Bar,
            encoding: {
                columns: { field: 'Category', type: tableau.VizImageEncodingType.Discrete },
                rows: { field: 'Measure', type: tableau.VizImageEncodingType.Continuous },
                sort: { field: 'Category', 'sortby': 'Weather', direction: tableau.VizImageSortDirectionType.Ascending }
            }
       };

    Returns Promise<string>

    A promise that when resolved, returns the viz as an svg.

    Supports sorting by field.

initializeAsync

  • initializeAsync(contextMenuCallbacks?: undefined | {}): Promise<void>
  • This is the entry point for an Extension. This function must first be called in order to interact with any of the other Extension APIs.

    Parameters

    • Optional contextMenuCallbacks: undefined | {}

      This optional object maps the ids of context menu items to the function to be triggered when that context menu item is selected. The keys listed must matched the keys registered in the context-menu element of the manifest. Currently, only a single context menu item is available ('configure') that creates the Configure... menu item), so this object will only contain a single entry. In this example, the 'configure' key is mapped to a function of the same name, which you would define in your JavaScript code.

        $(document).ready(function () {
          tableau.extensions.initializeAsync({'configure': configure}).then(function() {
          // When the user clicks the Configure... context menu item,
          // the configure function specified as the argument here
          // is executed.
          //
         });
        });

    Returns Promise<void>

    A promise that when resolved, the other Extension APIs will be available to use.

initializeDialogAsync

  • initializeDialogAsync(): Promise<string>
  • The initializeDialogAsync function is the entry point for an extension that runs inside a dialog box (or popup window) created by the UI namespace. A call to tableau.extensions.ui.displayDialogAsync(payload) creates the dialog box. When the extension running in the dialog box loads, the extension must first call the initializeDialogAsync function to use the rest of the Extension API. The initializeDialogAsync function should only be called by extensions that are displayed in a dialog box. You use the initializeAsync function to initialize the main extension, that is, the parent of the extension in the dialog box.

    Returns Promise<string>

    A promise that when resolved the other Extension APIs will be available to use. Contains a string that is the initial payload for the dialog as sent by the parent extension via tableau.extensions.ui.displayDialogAsync(payload). See displayDialogAsync for more information.

Dashboard Extensions Methods

setClickThroughAsync

  • setClickThroughAsync(clickThroughEnabled: boolean): Promise<void>
  • This method allows for clicks to pass through the extension window on Tableau Server.

    since

    1.7.0 and Tableau 2021.4

    Parameters

    • clickThroughEnabled: boolean

      A boolean which represents if clicks should pass through the extension window

    Returns Promise<void>

    A promise that resolves when the click through property has been set.

    The following example shows a call made to setClickThroughAsync.

       // disabling pointer events on the extension window
       tableau.extensions.setClickThroughAsync(true).then(() => {
        console.log('Successfully enabled extension window click through');
       }).catch((error) => {
        // Can throw an error if called from a dialog or on Tableau Desktop
          console.error(error.message);
        });