Jump to content
We've recently updated our Privacy Statement, available here ×
  • Differences between the TIBCO JasperReports® IO Javascript API and the TIBCO Jaspersoft® Visualize.js™ API


    stasp
    • Product: JasperReports IO

    The TIBCO JasperReports® IO Javascript API is very similar to the part of

    TIBCO Jaspersoft® Visualize.js™ responsible for report executions. It also relies on underlying REST API to execute the requests. If you have worked with Jaspersoft® Visualize.js in the past, switching to the JasperReports® IO API should be a smooth transition.

    That said, in addition to a slightly different naming, there are a couple of notable differences worth knowing before you get started. This short article outlines the main ones.

    Scope

    This is probably self evident, but just to make sure there is no confusion: JasperReports IO is a reporting service, so it only has API related to report execution. There is no syntax for Dashboards, Scheduler, Repository management etc like in Jaspersoft Visualize.js because that functionality is specific to TIBCO JasperReports® Server.

    Script naming

    This is also one of obvious differences: the Javascript library for JasperReports IO is called jrio.js. The syntax to embed it into your HTML page is very much the same as for Jaspersoft Visualize.js:

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

    Configuring the client

    With Jaspersoft Visualize.js pointing to the script hosted on a web server is enough to have the client configured. You also have optional properties to specify for the client using visualize.config method. However if you don't, things like server URL, locale, theme and dependent scripts are all picked up automatically based on visualize.js script location.

    With JasperReports IO Javascript API you must configure the following values for the client explicitely: server URL, scripts URL and locale. Otherwise you cannot successfully make a call. Here is an example of using the jrio.config method:

    jrio.config({
    server : "http://bi.example.com:8080/jrio",
    scripts : "http://bi.example.com:8080/myapp/jriojsapi/optimized-scripts",
    theme: {
    href: "http://bi.example.com:8080/myapp/jriojsapi/themes/default"
    },
    locale: "en_US"
    });

    For more details on the options availabe for this method please check section "5.2 Configuring the JasperReports IO Client" of JasperReports IO User Guide shipped with JasperReports IO distribution.

    User session

    Unlike JasperReports Server, JasperReports IO does not have users, roles or organizations, and the Javascript API does not have to deal with user sessions. Authentication is not a part of the API at all.

    Optimized VS non-optimized scripts

    Non-optimized scripts are preferred when you want to perform some runtime debugging for the JavaScript code.

    With Jaspersoft Visualize.js you can switch between optimized and non-optimized version of scripts by simply adding a "_opt=false" parameter to the script URL, e.g.:

    <script src="https://mobiledemo.jaspersoft.com/jasperserver-pro/client/visualize.js?_opt=false"></script>

    If you want to use the non-optimized jrio.js script, however, you will have to include all of the following references in your web page:

    <script src="http://bi.example.com:8080/myapp/jriojsapi/scripts/bower_components/
    requirejs/require.js"></script>
    <script src="http://bi.example.com:8080/myapp/jriojsapi/scripts/require.config.js"></script>
    <script src="http://bi.example.com:8080/myapp/jriojsapi/scripts/loader/jasper.js"></script>
    <script src="http://bi.example.com:8080/myapp/jriojsapi/scripts/client/jrio.js"></script>
    <script>
    require.config({
    baseUrl: "http://bi.example.com:8080/myapp/jriojsapi/scripts"
    });
    </script>

    Other notes

    These are the main differences you want to be aware of before getting started. As mentioned at the beginning, there are certain syntax differences as well theme configuation specifics, so you are encouraged to look through the JasperReports IO User Guide shipped with JasperReports IO distribution, as well as the samples available under http://<host>/jrio-docs/#javascript-api-samples of your JasperReports IO deployment.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...