2 Replies Latest reply on Apr 13, 2017 3:50 AM by Dragan Miskovic

    Error: Uncaught Cannot cast object to requested type

    Subodh Roche

      I am working on a project which is integrating Tableau dashboards into webpage using Tableau API. The components in the web page are based on angular2 coding.



      Home Component


      TS file...

      this.elm.nativeElement.style.width = '1200px'; this.elm.nativeElement.style.height = '800px'; this.elm.nativeElement.style.border = '1px solid #34fabb'; this.cast = new Tableau2.Viz(this.elm.nativeElement, this.url, { width: this.elm.nativeElement.clientWidth, height: 800, hideTabs: true, hideToolbar: true }); console.log(this.cast);


      I am getting an error like this...


      The error I get is "Uncaught Cannot cast object to requested type".


      I am trying to embed a private dashboard here. However, it works when I replace with any of the public dashboard. It also works with private dashboard if I directly embed using the iframe. It only doesn't work when I try the Javascript API call. It seems from the image above that the DOM element I am passing is getting recognized and a generated iframe is passed on to it by the Tableau API, however, it loses the object midway... and keeps returning null to functions that are trying to set the width,


      Any idea how to solve this?