Jasper: Report: Open and Render
Test Models
by tara5
HTML
<link rel="stylesheet" type="text/css" href="theme.css">
<script src="http://localhost:8080/jasperserver-pro/client/visualize.js"></script>
<!-- JQuery - Latest compiled and minified -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<select id="report">
<option value="/public/Samples/Reports/3_Store_Segment_Performance_Report">3_Store_Segment_Performance_Report</option>
<option value="/public/Samples/Reports/1._Geographic_Results_by_Segment_Report">1._Geographic_Results_by_Segment_Report</option>
<option value="/public/Samples/Reports/04._Product_Results_by_Store_Type_Report">04._Product_Results_by_Store_Type_Report</option>
<option value="/public/Samples/Reports/AllAccounts">AllAccounts</option>
<option value="/public/Samples/Reports/ProfitDetailReport" >ProfitDetailReport</option>
<option value="/public/Samples/Reports/RevenueDetailReport">RevenueDetailReport</option>
<option value="/public/Samples/Reports/08.UnitSalesDetailReport">08.UnitSalesDetailReport</option>
<option value="/public/Samples/Reports/2_Sales_Mix_by_Demographic_Report">2_Sales_Mix_by_Demographic_Report</option>
<option value="/chart_Report">chart_Report</option>
<option value="/chart_title_Report">chart_title_Report</option>
<option value="/crosstab_Report">crosstab_Report</option>
<option value="/table_Report">table_Report</option>
<option value="/public/Samples/Reports/9.CustomerDetailReport">9.CustomerDetailReport</option>
<option value="/public/Samples/Reports/10g.PerformanceByStoreType">10g.PerformanceByStoreType</option>
<option value="/public/Samples/Reports/SalesByMonthReport">SalesByMonthReport</option>
<option value="/public/Samples/Reports/12g.PromotionDetailsReport">12g.PromotionDetailsReport</option>
<option value="/public/Samples/Reports/13g.TopFivesReport" >13g.TopFivesReport</option>
<option...
CSS
#container {
width:100%;
}
/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
div {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}
JavaScript
visualize({
auth: {
name: "superuser",
password: "superuser",
}
}, function (v) {
function my_openReport(rep) {
//render report from provided resource
v("#container").report({
resource: rep,
error: handleError
});
}
my_openReport($("#report").val());
$("#report").change(function () {
$("#container").html("");
my_openReport($("#report").val());
});
//show error
function handleError(err) {
alert(err.message);
}
});