Basic drill-down

Use a master report and select from hyperlinks to open a secondary slave report within the same page.

HTML

<!--Provide URL to visualize.js-->
<script src="https://underscorejs.org/underscore.js"></script>
<script src="https://mobiledemo.jaspersoft.com/jasperserver-pro/client/visualize.js"></script>
<!--Provide container to render your visualization-->
<div>
  <h5>Select a city to open a drilldown report under the original.</h5>
    <div style="width:830px;" id="main"></div>
    <div style="width:500px;" id="drill-down"></div>
</div>

CSS

#main{
   float: left; 
}

#drill-down{
    float: left; 
}

JavaScript

visualize({
    auth: {
        name: "joeuser",
        password: "joeuser",
        organization: "organization_1"
    }
}, function (v) {
      
    v("#main").report({
        resource: "/public/viz/Hyperlinks/Drill_Reports_with_Controls/main_report",
        linkOptions: {
            beforeRender: function (linkToElemPairs) {
                linkToElemPairs.forEach(showCursor);
            },
            events: {
                "click": function(ev, link){
                   if (link.type == "ReportExecution"){
                        v("#drill-down").report({
                            resource: link.parameters._report,
                            params: {
                                city: [link.parameters.city],
                                country: link.parameters.country,
                                state: link.parameters.state
                            }, 
                        });     
                    }
                     console.log(link);
                }
            }    
        },
        error: function (err) {
            alert(err.message);
        }
    });
    
    function showCursor(pair){
           var el = pair.element;
               el.style.cursor = "pointer";
    }
    
});