<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>ActiveReportsJS Report Designer Report Master Report Sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script defer src="/activereportsjs/demos/arjs/dist/ar-js-core.js"></script>
<script defer src="/activereportsjs/demos/arjs/dist/ar-js-designer.js"></script>
<script defer src="/activereportsjs/demos/arjs/dist/ar-js-viewer.js"></script>
<script defer src="/activereportsjs/demos/arjs/dist/ar-js-pdf.js"></script>
<script defer src="/activereportsjs/demos/arjs/dist/ar-js-tabular-data.js"></script>
<script defer src="/activereportsjs/demos/arjs/dist/ar-js-html.js"></script>
<script defer src="$DEMOROOT$/lib/purejs/license.js"></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
type="text/css"
href="/activereportsjs/demos/arjs/styles/ar-js-ui.css"
/>
<link
rel="stylesheet"
type="text/css"
href="/activereportsjs/demos/arjs/styles/ar-js-viewer.css"
/>
<link
rel="stylesheet"
type="text/css"
href="/activereportsjs/demos/arjs/styles/ar-js-designer.css"
/>
<style>
#designer-host,
#viewer-host {
margin: 0 auto;
width: 100%;
height: 500px;
}
.hide {
display: none;
}
</style>
</head>
<body onload="onInit()">
<div id="designer-toolbar" class="container-fluid">
<div class="row mt-3 mb-3">
<button
id="btnDesignerOpen"
type="button"
class="btn btn-outline-primary btn-sm col-sm-2 ml-1 hide"
onclick="onOpenDesigner()"
>
Open Designer
</button>
</div>
</div>
<div id="designer-host"></div>
<div id="viewer-host" class="hide"></div>
<script>
function setVisibility(selector, isVisible) {
document.querySelectorAll(selector).forEach(function (element) {
isVisible
? element.classList.remove("hide")
: element.classList.add("hide");
});
}
function onOpenDesigner() {
setVisibility("#viewer-host, #btnDesignerOpen", false);
setVisibility("#designer-host, #btnPdfPreview", true);
}
function onInit(){
MESCIUS.ActiveReportsJS.Core.FontStore.registerFonts(
"/activereportsjs/demos/resource/fontsConfig.json"
);
var designer = new MESCIUS.ActiveReportsJS.ReportDesigner.Designer(
"#designer-host"
);
designer.setActionHandlers({
onRender: (report) => {
setVisibility("#viewer-host, #btnDesignerOpen", true);
setVisibility("#designer-host, #btnPdfPreview", false);
viewer.open(report.definition);
return Promise.resolve();
},
});
designer.createReport({
"reportType" : "CPL",
"masterReportId": "reports/MasterReport.rdlx-json"
})
var viewer = new MESCIUS.ActiveReportsJS.ReportViewer.Viewer(
"#viewer-host"
);
}
</script>
</body>
</html>