JSFiddle - React, Tailwind, and code Playground

by vysohanych

HTML

<script type="text/javascript" src="http://localhost:8080/jasperserver-pro/client/visualize.js?userLocale=ja"></script>
<div id="test">
    <input type="text" id="percent" size="10" value="100" disabled></input>
        <span>%</span>  
    <button id="resize" disabled>resize</button>
    <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>
    <button id="prev" >Prev Page</button>
    <button id="next" >Next Page</button>
    <button id="filter" >filter </button>
</div>
    
<table style="width:100%;">
    <tr valign="top">
        <td style="width:80%"><div id="report" ></div></td>
         <td valign="top" style="width:20%" ><div id="filters"></div></td>
    </tr>
</table>

CSS

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



#report{
    background-color:rgba(48,156,64,1);
}

#filters{
    height:500px;
    background-color:rgba(255,203,0,0.5);
}

JavaScript

var report,
    resource="/public/Visualize/Adhoc/Ad_Hoc_View_All_filters_Report",
zoom = 1,
    percent = document.getElementById("percent"),
    resize = document.getElementById("resize"),
    plus = document.getElementById("plus"),
    minus = document.getElementById("minus"),
    width = document.getElementById("width"),
    height = document.getElementById("height"),
    next = document.getElementById("next"),
    prev = document.getElementById("prev"),
    filter= document.getElementById("filter")
    page = document.getElementById("page");

visualize({
    auth: {
        name: "superuser",
        password: "superuser"
    }
}, function (v) {
    report = v.report({
        resource: resource,
        isolateDom: false,
        defaultJiveUi : {
            enabled :true
        },
        container: "#report",
        success: function () {
            plus.removeAttribute("disabled");
             percent.removeAttribute("disabled");
             resize.removeAttribute("disabled");
            minus.removeAttribute("disabled");
            width.removeAttribute("disabled");
            height.removeAttribute("disabled");
            page.removeAttribute("disabled");
            filter.removeAttribute("disabled");
        },
        error: function (err) {
            alert(err.message);
        }
    });

    
});

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

resize.onclick = function () {
    console.log(percent.value );
    report.scale(percent.value+"%").run();
}

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

width.onclick = function () {
    report.scale("width").run();
}

height.onclick = function () {
    report.scale("height").run();
}

filter.onclick = function () {
	var params={"ProductFamily":
                ["Drink","Food"]}
    report.params(params).run();
}

next.onclick = function () {
     var currentPage = report.pages() || 2;
    ...