JSFiddle - React, Tailwind, and code Playground

by Stas_P

HTML

<script src="http://localhost:8080/jrio-client/optimized-scripts/client/jrio.js"></script>

<div id="reportContainer"></div>

JavaScript

jrio.config({
  server: "http://localhost:8080/jrio",
  scripts: "http://localhost:8080/jrio-client/optimized-scripts",
  theme: {
    href: "http://localhost:8080/jrio-client/themes/default"
  },
  locale: "en_US"
});

jrio(function(jrioClient) {
  let report = jrioClient.report({
    resource: "/samples/reports/FirstJasper",
    container: "#reportContainer",
    events: {
      reportCompleted: function(status) {
        if (status === "ready") {
          exportToJson();
        }
      }
    },
    error: function(err) {
      alert(err);
    },
  });

  function exportToJson() {
    report
      .export({
        outputFormat: "data_json"
      })
      .done(function(link,request) {
        request({
            dataType: "json"
          })
          .done(function(data) {
            console.log(data);
          })
          .fail(function() {
          	console.log("Failed to load data")
          })
      })
	}
});