Skip to main content

WebDocumentViewerClientSideEventsBuilder.CustomizeElements(String) Method

Specifies the JavaScript function that handles the client-side CustomizeElements event.

Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer

Assembly: DevExpress.AspNetCore.Reporting.v24.1.dll

NuGet Package: DevExpress.AspNetCore.Reporting


public WebDocumentViewerClientSideEventsBuilder CustomizeElements(
    string callback


Name Type Description
callback String

The name of a JavaScript function or entire JavaScript function code that runs when the CustomizeElements event occurs.


Type Description

WebDocumentViewerClientSideEventsBuilder that can be used for method chaining.


The CustomizeElements event allows you to customize the Web Document Viewer’s UI elements.

The handler function receives two parameters. The first parameter is the object that exposes the IPreviewModel interface (or the JSReportViewer object). The second parameter contains the following properties and methods:

  • Elements. A collection of the UI elements included in the Web Document Viewer.
  • GetById. This method returns the Web Document Viewer visual element by its ID. The ID is one of the following DevExpress.Reporting.Viewer.PreviewElements enumeration members:
    • RightPanel - the Tab panel at the right of the Viewer.
    • Surface - the Viewer’s central section that displays the report document.
    • Toolbar - the Document Viewer’s Toolbar.

The code sample below demonstrates how to use this event to hide the Web Document Viewer’s Toolbar.

<script type="text/javascript" id="script"> 
  function customizeElements(s, e) {
      var toolbarPart = e.GetById(
      var index = e.Elements.indexOf(toolbarPart);
      e.Elements.splice(index, 1);

  var documentViewer = Html.DevExpress().WebDocumentViewer("webDocumentViewer1")
      .ClientSideEvents(configure => 
See Also