Back to Devexpress

Use the Report and Dashboard Server as a Backend

xtrareports-400083-web-reporting-knockout-reporting-document-viewer-use-the-report-and-dashboard-server-as-a-backend.md

latest3.7 KB
Original Source

Use the Report and Dashboard Server as a Backend

  • Jan 06, 2024
  • 5 minutes to read

This document describes how to integrate the Web Document Viewer to JavaScript and display documents that are created remotely with the DevExpress Report and Dashboard Server. The Report and Dashboard Server acts as a server (backend) part and you should create a client (frontend) part with all the necessary styles, scripts, and HTML-templates.

You can use a Bearer token to access the protected API that the Report and Dashboard Server provides to access its documents. This topic demonstrates how to obtain this token based on the resource owner password credentials grant.

Tip

See the following online examples:

Configure the Report and Dashboard Server

  1. Create a Server account (with Server authentication) that the Web Document Viewer uses in your application.

  2. Give this account at least read permissions to all the required documents.

  3. Enable Cross-Origin Resource Sharing (CORS) on the screen with the Server settings and restart the Report and Dashboard Server to apply the changes.

  4. Configure SSL on IIS to access the Report and Dashboard Server web site using SSL.

Integrate the Document Viewer to JavaScript

  1. Create a new folder to store all the files related to the client-side functionality (for instance, name it ClientSide ).

  2. Add the package.json configuration file to the created folder and list the following third-party packages the Web Document Viewer requires:

  3. Install Node.js and npm if they do not exist on your machine.

  4. Navigate to your folder, open the console and run the command below to install packages:

  5. In the console window, execute the following commands to install the Webpack CLI globally:

  6. Create a new webpack.config.js file and specify configuration settings as shown below. Define the index.js file as the bundle’s entry point (this file is created later) and the bundle.js file as the output file.

  7. Create a View file (the index.html file in this example) and specify this View’s HTML template. Do the following in the body section:

  8. Add a new JavaScript file ( index.js ) to perform the nessesary actions and provide data to the View:

  9. Create a new style.css file and link the required styles.

  10. Run the following command in the console to create the bundle:

  11. Host your client-side part on the web server.

View the Result

For the example to work correctly, you should first open your Report and Dashboard Server web site, and then run a client part. Select a report in the drop-down list to open it in the Web Document Viewer.

See Also

Display Documents from the Report and Dashboard Server