Coder Social home page Coder Social logo

testdev-examples / blazor-reporting-ui-customization-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 398 KB

This example demonstrates how to use the client-side Blazor Reporting API to customize the Document Viewer and End-User Report Designer behavior and appearance.

License: Other

HTML 33.86% C# 52.49% JavaScript 13.65%
blazor xtrareport reporting

blazor-reporting-ui-customization-api's Introduction

Blazor Reporting - UI Customization API

This example demonstrates how to use client-side Blazor Reporting API to customize the Document Viewer and End-User Report Designer components.

Overview

The Document Viewer and Report Designer use the following objects to specify clint-side event handlers:

You can define a client-side handler - a global function - in a separate JavaScript file. For example, the following function will handle the BeforeRender event to specify the Document Viewer's zoom level:

reporting_ViewerCustomization.js file

window.ReportingViewerCustomization = {
	//Change default Zoom level
	onBeforeRender: function(s, e) {
	    //-1: Page Width
	    //0: Whole Page
	    //1: 100%
	    e.reportPreview.zoom(-1);
	}
}

Reference the script file from the _Host.cshtml page.

_Host.cshtml file

<script src="~/js/reporting_ViewerCustomization.js"></script>

Assign the client-side function's name to a property in one of the objects mentioned above - DxDocumentViewerCallbacks or DxReportDesignerCallbacks.

  • Viewer.razor file
<DxDocumentViewer ReportUrl="SampleReport" Height="1000px" Width="100%">
	<DxDocumentViewerCallbacks BeforeRender="ReportingViewerCustomization.onBeforeRender" />
</DxDocumentViewer>

Note that you cannot use named constants in JavaScript functions. Specify strings instead.

Example: Localization

Related pages: LocalizationViewer.razor and LocalizationDesigner.razor.

To localize Document Viewer and Report Designer UI, you need the following resources:

  • jQuery library. Add a reference to the _Host.cshtml page.
  • Translations in JSON format. You can obtain the files from the DevExpress Localization Service. Review the Localization help topic for more information.

The reporting_Localization.js file contains the onCustomizeLocalization function that loads JSON localization files. The files are located in the wwwroot\js\localization folder. Razor page markup assigns the function name to the CustomizeLocalization property in DxDocumentViewerCallbacks or DxReportDesignerCallbacks.

Example: Anti-Forgery Tokens

Related pages: DesignerCsrf.razor and ViewerCsrf.razor.

To implement anti-forgery tokens that prevent CSRF attack, do the following:

Example: Document Viewer UI Customization

Related pages: ViewerCustomization.razor. The reporting_ViewerCustomization.js file contains JavaScript functions that customize the Document Viewer in the following manner:

Event Handler Implementation
CustomizeParameterEditors Removes the time portion in the DateTime parameter editor.
BeforeRender Sets the default zoom level to "Page Width".

Example: End-User Report Designer UI Customization

Related pages: DesignerCustomization.razor.

The reporting_DesignerCustomization.js file contains JavaScript functions that customize the Report Designer in the following manner:

Event Handler Implementation
CustomizeElements Removes the Menu button
CustomizeMenuActions Moves the Save and New buttons from the Menu to the Toolbar.
ReportOpened Creates a custom report when users press the New button.
BeforeRender Runs the Wizard when the Report Designer starts.
CustomizeWizard Removes certain report types from the Report Wizard.

blazor-reporting-ui-customization-api's People

Contributors

andreylepikhov avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.