...
Table of Contents | ||
---|---|---|
|
Tips
...
The enclosing element should have no padding or border. If you want a border or padding around your report or dashboard you should enclose the element in another element that has the padding or border. For example:
...
<div style="padding: 10px; border: 1px solid black;">
<div id="myReport">
</div>
</div>
<script type="text/javascript">
yellowfin.loadReport({reportUUID: 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63', elementId: 'myReport' });
</script>
If you are using the basic method, and do not pass an elementId to the API, the enclosing element is created automatically. You can enclose the script tag in another element with padding or border styles applied. For example:
...
<div style="padding: 10px; border: 1px solid black;">
<script type="text/javascript" src="http://localhost/JsAPI?reportUUID=e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63&width=500&width=350"></script>
</div>
...
Troubleshooting
As mentioned previously, you can check the window.yellowfin
variable to determine if the Javascript API has been loaded successfully. For example, when using the basic method:
...
<script src="http://localhost/JsAPI?reportUUID=e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63&width=500&height=500" type="text/javascript"></script>
<script typt="text/javascript">
if (!window.yellowfin) {
alert('Error loading API');
}
</script>
When using the advanced method, you can use this to determine whether or not to attempt to load a report or dashboard:
...
<script src="http://localhost/JsAPI" type="text/javascript"></script>
<script typt="text/javascript">
if (window.yellowfin) {
yellowfin.loadReport({reportUUID: 'e5e5aaf3-c3b8-4f9b-8280-e21e4d848e63',
elementId: 'myReport' });
} else {
alert('Error loading API');
}
</script>
Errors encountered when using the API are generally presented through Javascript alerts. These include a description of the error. Common errors include:
Error | Description |
---|---|
API version requested is not supported | The server does not support the API version requested. |
reportUUID not specified | The |
Report not found | The report specified by the |
Report not loaded | An operation has been attempted on a report that has not yet been loaded. |
Report is in draft mode | The report specified is in draft mode. Only active reports can be accessed through the Javascript API. |
User does not have access to this report | The user logged in does not have access to the requested report. |
Invalid command specified | An invalid request has been made to the API. |
Error loading report | A server-side error occurred while running an API command. Check the Yellowfin server logs for more information. |
dashUUID not specified | The |
Dashboard not found | The dashboard specified by the |
User does not have access to this dashboard | The user logged in does not have access to the requested dashboard. |
Dashboard is in draft mode | The dashboard specified is in draft mode. Only active dashboards can be accessed through the Javascript API. |
...
ヒント