Report deletion Example

by vysohanych

HTML

<!--Provide URL to visualize.js-->
<script type='text/javascript' src="http://localhost:8080/jasperserver-pro/client/visualize.js?_opt=false"></script>
<!--Provide container to render your visualization-->
<br/>
<button id="test">delete</button>
<br/><br/>
<div id="report">
  <div><p>Loading...</p></div>
</div>

CSS

#container {
    width: 800px;
    height: 600px;
}

/* You can replace the following with your own custom loading indicator */
@import "compass/css3";

@keyframes fadeIn { 
  from { opacity: 0; } 
}

JavaScript

visualize({
    auth: {
        name: "jasperadmin",
        password: "jasperadmin",
        organization: "organization_1"
    }
}, function (v) {

    var report = v.report({
        resource: "/public/Ad_Hoc_View_Report",
        container: "#report",
        error: function (err) {
            alert(err.message);
        }
    });
   document.getElementById("test").addEventListener("click", function(){
       console.log("called");
        report.destroy();
   
   })
});