JSFiddle - React, Tailwind, and code Playground

by Yuriy Bablyukh

HTML

<link rel="stylesheet" href="http://gridster.net/dist/jquery.gridster.min.css">
<script type="text/javascript" src="http://build-master.jaspersoft.com:6680/jrs-pro-feature-visualizejs/client/visualize.js"></script>
<div>
    <button id="plus" disabled>+</button>
    <button id="minus" disabled>-</button>
    <button id="width" disabled>Fit Width</button>
    <button id="height" disabled>Fit Height</button>
    <button id="page" disabled>Fit Page</button>
</div>
<div id="c1"></div>

CSS

li {
    border: thin solid red;
    list-style: none;
}

JavaScript

var report,
zoom = 1,
    plus = document.getElementById("plus"),
    minus = document.getElementById("minus"),
    width = document.getElementById("width"),
    height = document.getElementById("height"),
    page = document.getElementById("page");

visualize({
    auth: {
        name: "superuser",
        password: "superuser"
    }
}, function (v) {
    report = v.report({
        resource: "/public/Samples/Reports/06g.ProfitDetailReport",
        container: "#c1",
        fitToContainer: true,
        success: function () {
            plus.removeAttribute("disabled");
            minus.removeAttribute("disabled");
            width.removeAttribute("disabled");
            height.removeAttribute("disabled");
            page.removeAttribute("disabled");
        },
        error: function (err) {
            alert(err.message);
        }
    });
});

plus.onclick = function () {
    report.zoom(zoom += 0.1);
}

minus.onclick = function () {
    report.zoom((zoom -= 0.1) > 0 ? zoom : zoom = 0.1);
}

width.onclick = function () {
    report.zoom("fitWidth");
}

height.onclick = function () {
    report.zoom("fitHeight");
}

page.onclick = function () {
    report.zoom("fitContainer");
}