-
1. Re: Access the API and Viz Class: when fetching a Tableau, onFirstInteractive never gets called.
Ciaran BourceMay 30, 2018 9:22 AM (in response to Audrey Jean-Weisz)
Hi Audrey,
Are you using a custom view ? If yes I suggest using getCustomViewsAsync to make sure the view is fully loaded.
Ciaran
-
2. Re: Access the API and Viz Class: when fetching a Tableau, onFirstInteractive never gets called.
Audrey Jean-Weisz May 31, 2018 12:30 PM (in response to Ciaran Bource)Hi Ciaran,
Thank you for your respond.
When I use:viz.getWorkbook().getCustomViewAsync, it returns an error and I think it's because viz is still null and can't get getWorkbook().
Also what do you mean exactly by custom view? Just to make sure that I understand correctly?
Thank you very much in advance!
-
3. Re: Access the API and Viz Class: when fetching a Tableau, onFirstInteractive never gets called.
Ciaran BourceJun 1, 2018 12:44 AM (in response to Audrey Jean-Weisz)
Hi Audrey,
Here's a code snippet for onFirstInteractive
<script type="text/javascript">
function initViz() {
var containerDiv = document.getElementById("vizContainer");
var url = "http://public.tableau.com/views/RegionalSampleWorkbook/Storms";
var options = {
hideTabs: true,
onFirstInteractive: function () {
console.log("Run this code when the viz has finished loading.");
}
};
var viz = new tableau.Viz(containerDiv, url, options);
// Create a viz object and embed it in the container div.
}
</script>
Note: Custom views are not guaranteed to be loaded when the viz becomes interactive. Use the
getCustomViewsAsync
method to make sure that all the views are loaded before you call theshowCustomViewAsync
method.Here is a link about custom views : Use Custom Views
Ciaran
-
4. Re: Access the API and Viz Class: when fetching a Tableau, onFirstInteractive never gets called.
Audrey Jean-Weisz Jun 5, 2018 9:20 AM (in response to Ciaran Bource)Hi Ciaran!
unfortunately, I couldn't resolve this issue. When I print the result of the viz object in the console here are the functions it only has
Then, if I try what you suggested: viz.getWorkbook() first, I get the following error :
Finally, if I use: viz.getCustomViewsAsync(), the property (viz) is said to be undefined..
Thank you again for your support ! I am looking forward to your reply...
Sincerely,
Audrey JW.
-
5. Re: Access the API and Viz Class: when fetching a Tableau, onFirstInteractive never gets called.
Ciaran BourceJun 6, 2018 12:44 AM (in response to Audrey Jean-Weisz)
Hi Audrey,
Have you had a look at this page ?
Tableau JavaScript API Concepts--Initializing the API
That has way more information that the previous one.
Ciaran