Visualize.js: Reset Input Controls

Reset embedded JRS Input Controls back to their original state.

by Stas_P

HTML

<script type='text/javascript' src="https://mobiledemo.jaspersoft.com/jasperserver-pro/client/visualize.js"></script>

<!-- JQuery - compiled and minified -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

<div id="containerAdhocInput" class="containerInput">
  <div>
    <p>Loading...</p>
  </div>
</div>

CSS

.containerInput {
  width: 300px
}

JavaScript

/*
The sample prints the initial values of Ad Hoc View Filters into console
It also re-prints the state of input controls each time the values are updated 
*/

visualize({
  auth: {
    name: "joeuser",
    password: "joeuser"
  }
}, function(v) {
  var icAdHocView = v.inputControls({
    resource: "/public/Samples/Ad_Hoc_Views/05__Unit_Sales_Trend",
    container: "#containerAdhocInput",
    success: function(data) {
      console.log("Ad Hoc View IC:", data);
    },
    events: {
      change: function(state) {
        console.log(state);
      }
    }
  })
});