
Hi so I am right trying to combine this code..... Export Embedded Views (tableau.com) ... with this code GitHub - aalteirac/jwt_spa. Both are written in Tableau V3, but have different ways of writting Javascript API(*).
I was able to reproduce the error that I am getting by taking the code found in the first link and changing this line
<script type="module">
import { TableauViz, TableauEventType, TableauDialogType } from "https://public.tableau.com/javascripts/api/tableau.embedding.3.latest.min.js"
const tableauViz = document.querySelector('tableau-viz');
To this line:
<script type="module" src="https://public.tableau.com/javascripts/api/tableau.embedding.3.latest.js"></script>
<script>
//import { TableauViz, TableauEventType, TableauDialogType } from //"https://public.tableau.com/javascripts/api/tableau.embedding.3.latest.min.js"
const tableauViz = document.querySelector('tableau-viz');
I have experienced this error alot in D3 and the primary cause is almost always the fact that the package does not load all its dependencies properly. In fact there used to be an entire website just dedicated to testing D3 for IT students to use so they could figure out errors in code.
So basically, I am asking how with the API do I force it to load not only event listener, but every package and function I need? To explicitly define them all?
At least until package load bugs can be fixed with the Tableau API Embedding Javascript package. I think they might be called frameworks.
@Michael Lane
Intead of using the constants, I would prefer to use the literal strings:
https://help.tableau.com/current/api/embedding_api/en-us/reference/enums/tableaudialogtype.html
export-cross-tab
export-data
export-pdf
export-powerpoint
export-workbook
share
https://help.tableau.com/current/api/embedding_api/en-us/reference/enums/tableaueventtype.html
I also have gotten some problems while using the TableauEventType, TableauDialogType constants
So instead of using:
await tableauViz.displayDialogAsync(TableauDialogType.ExportPDF);
I prefer to use the literal value of the constants.
await tableauViz.displayDialogAsync('export-pdf');If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.
Regards,
Diego Martinez
Tableau Visionary and Forums Ambassador