1

I am using Javascript API to embed tableau reports in my website. I want the default Tableau behaviour of it saving the filters of one dashboard in a workbook, while moving to another dashboard in the similar workbook.

For example:

If default date in a workbook is Jan-1 and I change it to Jan-2 in one of the dashboards, it should reflect in other dashboards in the same workbook. (In my embedded Tableau workbook!)

My code:

function initializeViz(url){
    var placeholderDiv = document.getElementById("tableauViz");
    var options = {
        width: placeholderDiv.offsetWidth,
        height: placeholderDiv.offsetHeight,
        hideTabs: true,
        hideToolbar: true,
        onFirstInteractive: function () {
            workbook = viz.getWorkbook();
            activeSheet = workbook.getActiveSheet();
        }
    };
    var x=url;
    if(viz!=null){
    viz.dispose();}
    viz = new tableauSoftware.Viz(placeholderDiv, url, options);
}

P.S.

This is closest thing I could find: Saving and restoring current view state of a Tableau graph through javascript API

I tried to find to find solution/documentation here: http://documents.tips/documents/javascript-api.html

0

1 Answer 1

0

I think you have two options here:

  1. If the user is changing a filter in the dashboard you can make the filter apply to all worksheets using the same data source (does not require the JS API and is very simple to do). enter image description here

  2. If you want to read the filters from the view and then apply them somewhere else you can use Worksheet.getFiltersAsync() which returns a collection of Filter classes.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply. Option 1, it is already implemented, but it doesn't work when the dashboards are embedded in tableau. Regarding Option 2, it gives a Javascript Object with all filter values and only way I know to apply it to another sheet is to parse the Object and apply filters one by one to another worksheets, that's a lengthy painful process. So, this doesn't help me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.