These samples show how to use pre-defined resources with the ActiveReportsJS Designer component with Angular, React, Vue, and pure JavaScript applications.
Image
property in the property grid.
(Icons made by Linector from www.flaticon.com)Visit the Using Predefined Data Sources and Use-Shared-Resources for more information. Scroll down the page to see the code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>ActiveReportsJS Report Designer Predefined Resources Sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="/activereportsjs/demos/arjs/dist/ar-js-core.js"></script>
<script src="/activereportsjs/demos/arjs/dist/ar-js-viewer.js"></script>
<script src="/activereportsjs/demos/arjs/dist/ar-js-pdf.js"></script>
<script src="/activereportsjs/demos/arjs/dist/ar-js-tabular-data.js"></script>
<script src="/activereportsjs/demos/arjs/dist/ar-js-html.js"></script>
<script src="/activereportsjs/demos/arjs/dist/ar-js-designer.js"></script>
<script src="$DEMOROOT$/lib/purejs/license.js"></script>
<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>
@import url("https://cdn.materialdesignicons.com/2.8.94/css/materialdesignicons.min.css");
#designer-host,
#viewer-host {
width: 100%;
height: 550px;
}
</style>
</head>
<body>
<div id="designer-host"></div>
<div id="viewer-host"></div>
<script src="resources.js"></script>
<script>
MESCIUS.ActiveReportsJS.Core.FontStore.registerFonts(
"/activereportsjs/demos/resource/fontsConfig.json"
);
const designer = new MESCIUS.ActiveReportsJS.ReportDesigner.Designer(
"#designer-host"
);
designer.setActionHandlers({
onRender: (report) => {
document.getElementById("viewer-host").style.display = "";
document.getElementById("designer-host").style.display = "none";
viewer.open(report.definition);
return Promise.resolve();
},
});
designer.setDataSourceTemplates(resources.dataSources);
designer.setResourceProvider({
getImagesList: async () => resources.images,
});
designer.setReport({ id: "reports/initial.rdlx-json" });
var viewer = new MESCIUS.ActiveReportsJS.ReportViewer.Viewer(
"#viewer-host"
);
var designButton = {
key: "$openDesigner",
text: "Edit in Designer",
iconCssClass: "mdi mdi-pencil",
enabled: true,
action: () => {
document.getElementById("viewer-host").style.display = "none";
document.getElementById("designer-host").style.display = "";
},
};
viewer.toolbar.addItem(designButton);
viewer.toolbar.updateLayout({
default: [
"$openDesigner",
"$split",
"$navigation",
"$split",
"$refresh",
"$split",
"$history",
"$split",
"$zoom",
"$fullscreen",
"$split",
"$print",
"$split",
"$singlepagemode",
"$continuousmode",
"$galleymode",
],
});
document.getElementById("viewer-host").style.display = "none";
</script>
</body>
</html>
Submit and view feedback for