JSFiddle - React, Tailwind, and code Playground
by Yuriy Bablyukh
HTML
<script src="http://build-master.jaspersoft.com:8580/jrs-pro-feature-dashboard-improvements-for-jasper-mobile/client/visualize.js"></script>
<button id="hideToolbar">hide Toolbars</button>
<button id="showToolbar">show Toolbars</button>
<button id="disableInteractive">disable Interactive</button>
<div id="container"></div>
CSS
html, body, #container {
height: 100%;
width: 100%;
margin: 0;
}
JavaScript
visualize({
auth: {
name: "jasperadmin",
password: "jasperadmin",
organization: "organization_1"
}
}, function (v) {
var components;
var dashboard = v.dashboard({
resource: "/public/Samples/Dashboards/1._Supermart_Dashboard",
container: "#container",
error: function (e) {
alert(e);
},
success: function (data) {
console.log(data);
}
});
$("#hideToolbar").on("click", function () {
components = dashboard.data().components;
components.forEach(function (component) {
component.toolbar = false;
});
dashboard.updateComponent(components).fail(function (data) {
console.log(data)
}).done(
function (data) {
console.log(data)
});
});
$("#showToolbar").on("click", function () {
components = dashboard.data().components;
components.forEach(function (component) {
component.toolbar = true;
});
dashboard.updateComponent(components).fail(function (data) {
console.log(data)
}).done(
function (data) {
console.log(data)
});
});
$("#disableInteractive").on("click", function () {
components = dashboard.data().components;
components.forEach(function (component) {
component.interactive = false;
});
dashboard.updateComponent(components).fail(function (data) {
console.log(data)
}).done(
function (data) {
console.log(data)
});
});
});