Page anchors

Control report pagination with page anchors.

HTML

<script src="https://mobiledemo.jaspersoft.com/jasperserver-pro/client/visualize.js"></script>
<div style="font-size: 11pt">Report will load default anchor "Cliffside"</div>
<br><br>
Go to a report anchor: <input type="text" id="anchor"/>
<div style="font-size: 9pt">For example: Bellingham</div>
<br><br>
<div id="container"></div>

CSS

#container {
    height: 400px;
    overflow-y: scroll;
    width: 100%;
}

JavaScript

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

    var report = v.report({
        resource: "/public/Samples/Reports/17._Report_Workbook",
        container: "#container",
        pages: {
            anchor: "Cliffside"
        },
        error: function(e) {
            alert(e);
        }
    });
    
    $("#anchor").on("change", function() {
        report
            .pages({ anchor: $(this).val() })
            .run()
            .fail(function(e) { alert(e); });
    });
});