Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Dashboard

The Dashboard interface inherits from the Sheet interface.

Hierarchy

Index

Properties

name

name: string
returns

The name of the sheet.

objects

objects: Array<DashboardObject>
returns

The collection of objects contained in the dashboard.

sheetType

sheetType: SheetType
returns

The type of the sheet.

size

size: Size
returns

Size of the sheet.

worksheets

worksheets: Array<Worksheet>

This is a helper method and is equivalent to looping through all of the objects in a dashboard and collecting all of the objects whose type is worksheet. You can use this property to iterate through all of the worksheets in the dashboard.

returns

The collection of worksheets contained in the dashboard.

The following example uses the JavaScript forEach() method to traverse the worksheets in the dashboard.

   let dashboard = tableau.extensions.dashboardContent.dashboard;
   dashboard.worksheets.forEach(function (worksheet) {
    // do something with the worksheets..
      console.log("The worksheet name is " + worksheet.name)
    });

Methods

addEventListener

  • Adds a new event listener to the object. If this object does not support the specified eventType, the method throws an exception. The following table shows the event types supported by objects.

    object eventType
    Worksheet FilterChanged , MarkSelectionChanged
    Parameter ParameterChanged
    Settings SettingsChanged
    Dashboard None available

    Parameters

    • eventType: TableauEventType

      The type of event to register for. The type of event is a TableauEventType enumeration.

    • handler: TableauEventHandlerFn

      The function which will be called when an event happens.

    Returns TableauEventUnregisterFn

    A helper function which can be called to remove this registration.

    The following example sets up a listener in a worksheet for a mark selection event (MarkSelectionChanged). When the event occurs, the data is reloaded. The addEventListener method returns a function that un-registers the event handler. Call that function, in this case, unregisterEventHandlerFunction() to remove the registration.

    // Add an event listener for the selection changed event on this sheet.
    // Assigning the event to a variable just to make the example fit on the page here.
    const markSelection = tableau.TableauEventType.MarkSelectionChanged;
    //
    unregisterEventHandlerFunction = worksheet.addEventListener(markSelection, function (selectionEvent) {
    // When the selection changes, reload the data
    loadSelectedMarks(worksheetName);
    });
    
    // remove the event listener when done
     unregisterEventHandlerFunction();
    
    

findParameterAsync

  • findParameterAsync(parameterName: string): Promise<Parameter | undefined>
  • Searches for a parameter with the given name in the dashboard.

    Parameters

    • parameterName: string

      The name of the parameter to find.

    Returns Promise<Parameter | undefined>

    The parameter with the given name, or undefined if it does not exist.

getParametersAsync

  • getParametersAsync(): Promise<Array<Parameter>>
  • Returns Promise<Array<Parameter>>

    A collection of all the Tableau parameters that are used in this workbook.

removeEventListener

  • Removes an event listener if a matching one is found. If no matching listener exists, the method does nothing. The handler function must the handler function specified in the call to the addEventListener method. Alternatively, use the function returned from the call to addEventListener to unregister the event listener. For more information, see Events and Event Handling

    Parameters

    Returns boolean

    Whether or not an event listener was removed.

setZoneVisibilityAsync

  • setZoneVisibilityAsync(zoneVisibilityMap: Map<number, ZoneVisibilityType>): Promise<void>
  • Sets the visibility of one or more floating dashboard zones. Throws an error if the zone is invalid or if the zone is not floating

    since

    1.1.0

    The following example shows how you can update the visibility of multiple (valid, floating) zones in a dashboard

      var zoneVisibilityMap = {};
      zoneVisibilityMap[10] =  tableau.ZoneVisibilityType.Show;
      zoneVisibilityMap[8] =  tableau.ZoneVisibilityType.Hide;
      tableau.extensions.dashboardContent.dashboard.setZoneVisibilityAsync(zoneVisibilityMap).then(() => {
        console.log("done");
      });
    
    

    Parameters

    • zoneVisibilityMap: Map<number, ZoneVisibilityType>

      A map of zone ids to the desired state of visibilty for that zone.

    Returns Promise<void>

    Empty promise that resolves when the visibility has been changed.