Visualize: render report and export to docx

fr locale

by Valera

HTML

<script src="http://code.jquery.com/jquery-2.1.0.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://build-master.jaspersoft.com:7980/jrs-pro-bugfix/client/visualize.js?logEnabled=true&_showInputControls=true&_opt=false&userLocale=en_US&logLevel=error"></script>
<div id="filters"></div>

<div class="test">
  <div class="aaaa">
    <button type="button" id="NextPage">NextPage</button>
  </div>
  <div id="container"></div>
</div>

CSS

.test{
  height: 100%;
}
.aaaa{
  heigth:50px;
}
#container{
  height: 400px; position: relative; overflow: scroll;
}

JavaScript

var reportUri = "/public/11._Top_5_Products_by_City_Report";

visualize({
  auth: {
    name: "superuser",
    password: "superuser"
  }
}, function(v) {

  var report = v.report({
    resource: reportUri,
    container: "#container",
    defaultJiveUi: {
            floatingCrosstabHeadersEnabled: true
        },
    success: function(data) {
      console.log(data);
    },
    events: {
      bookmarksReady: function(data) {
        console.log(data);
      },
      reportPartsReady: function(data) {
        console.log(data);
      },
      canUndo: function(canUndo) {
        if (canUndo) {
          console.log("Event canUndo executed, now user can Undo");
        } else {
          console.log("Event canUndo executed, now user can't Undo");
        }
      },
      canRedo: function(canRedo) {
        if (canRedo) {
          console.log("Event canRedo executed, now user can redo");
        } else {
          console.log("Event canRedo executed, now user can't redo");
        }
      },
      changeTotalPages: function(totalPages) {
        if (typeof(totalPages) === "undefined" || totalPages === 0) {
          var $container = $("#container");
          $container.append("<div class='alert alert-warning col-sm-6 col-sm-offset-3' style='margin-top:150px; ' role='alert'><h3 style='text-align: center;'>Report Is empty</h3></div>");
        }
        console.log("Event changeTotalPages executed, we have: " + totalPages + " - pages");
      },
      reportCompleted: function(status) {
        console.log("Event reportCompleted executed with status: " + status);
      },
      changePagesState: function(page) {
        console.log("Event changePageState executed with page: " + page);
      }
    }
  });


  $("#NextPage").click(function() {
    var currentPage = report.pages() || 0;
    report.pages(++currentPage).run();
  });

});