The following options can be set during initialization or at run time while working with the JS Viewer.

interface InitializationOptions {
    action?: ((actionType, actionParams) => void);
    animation?: AnimationOptions;
    autoBackgroundColor?: boolean;
    availableExports?: ExportTypes[];
    defaultExportSettings?: DefaultExportSettings;
    displayMode?: ViewMode;
    documentLoaded?: (() => void);
    element: string;
    error?: ((error) => boolean);
    initialZoomMode?: InitialZoomMode;
    locale?: string;
    localeData?: JSON;
    localeUri?: string;
    pageView?: PageViewOptions;
    panelsLocation?: PanelsLocation;
    parametersPanel?: ParametersPanelSettings;
    renderFormat?: RenderFormat;
    renderMode?: RenderMode;
    reportID?: string;
    reportLoaded?: ((reportInfo) => void);
    reportParameters?: Parameter[];
    reportService?: ReportServiceSettings;
    silentPrint?: boolean;
    theme?: UITheme;
}

Properties

action?: ((actionType, actionParams) => void)

The callback that is invoked before the JS Viewer opens the hyperlink, bookmark link, drill down report or toggles the report control visibility.

Type declaration

    • (actionType, actionParams): void
    • Parameters

      • actionType: string
      • actionParams: any[]

      Returns void

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
action: (actionType, actionParams) => console.log('Action type: ' + actionType + '; Action parameters: ' + actionParams)
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
action: (actionType, actionParams) => console.log('Action type: ' + actionType + '; Action parameters: ' + actionParams)
});
animation?: AnimationOptions

The report view animation options.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
animation: {
loadChart: {
enabled: true
},
hoverChart: {
enabled: true
},
hoverTable: {
enabled: true,
backgroundColor: 'LightGray',
textColor: 'DarkGray'
}
}
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
animation: {
loadChart: {
enabled: true
},
hoverChart: {
enabled: true
},
hoverTable: {
enabled: true,
backgroundColor: 'LightGray',
textColor: 'DarkGray'
}
}
});
autoBackgroundColor?: boolean

When true, view area background color is filled with report body color available only for dashboard reports

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
autoBackgroundColor : true;
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
autoBackgroundColor : true;
});
availableExports?: ExportTypes[]

The array of export types available via Export functionality of JS Viewer. By default, Mht, Pdf, Tiff, Xls, Xlsx, Csv, Doc, Docx, Json, Xml, TextPrint, XlsxData and CsvData exports are available for page reports, Mht, Pdf, Tiff, Xls, Xlsx, Rtf and Txt exports are available for section reports.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
availableExports: ['Xml', 'Pdf']
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
availableExports: ['Xml', 'Pdf']
});
defaultExportSettings?: DefaultExportSettings

The object containing custom default export settings. Use to set default value and visibility of any field in the export panel. Format keys are mht, pdf, tiff, xls, xlsx, csv, doc, docx, json, xml, xlsxData, csvData, rtf and txt. Settings' keys are the export settings which are available for RenderingExtensions.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
defaultExportSettings: {
xls: {
FileName: {
value: "Hihihi",
visible: false
}
}
}
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
defaultExportSettings: {
xls: {
FileName: {
value: "Hihihi",
visible: false
}
}
}
});
displayMode?: ViewMode

Set up single page or continuous page.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
displayMode: 'Continuous'
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
displayMode: 'Continuous'
});
documentLoaded?: (() => void)

The callback that is invoked when a document is loaded entirely on the server.

Type declaration

    • (): void
    • Returns void

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
documentLoaded: () => console.log('The document is loaded entirely on the server')
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
documentLoaded: () => console.log('The document is loaded entirely on the server')
});
element: string

JQuery selector that specifies the element that hosts the JS Viewer control.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
element: '#viewerContainer'
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
element: '#viewerContainer'
});
error?: ((error) => boolean)

The callback that is invoked when an error occurs in the process of displaying the report. The default error panel does not appear if the callback doesn't reurn proper object. The error parameter is an object that has a message property which allows the users to customize the error message and caption property which allows to customize error caption.

Type declaration

    • (error): boolean
    • Parameters

      Returns boolean

Example: To hide the default error panel:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
error: (error) => {
if (error.message) {
// show error message.
alert("Internal error! Please ask administrator.");
// do not show default error message.
return true;
}
}
});

Example: To hide the default error panel:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
error: (error) => {
if (error.message) {
// show error message.
alert("Internal error! Please ask administrator.");
// do not show default error message.
return true;
}
}
});
initialZoomMode?: InitialZoomMode

Set up the initial zoom mode.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
initialZoomMode: 'FitToWidth';
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
initialZoomMode: 'FitToWidth';
});
locale?: string

Specifies locale used for displaying Viewer. If locale is not specified explicitly here, the locale corresponding to the browser preferences is used.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
locale: 'ja-JP'
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
locale: 'ja-JP'
});
localeData?: JSON

The JSON containing the localization strings. Not all strings are necessary — missing values ​​will be displayed using EN localization data.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
localeData: JSON.parse( `{
"export": {
"boolTextFalse": "Нет",
"boolTextTrue": "Да"
},
"viewer": {
"toolbar": {
"refresh": "Обновить"
}
}
}`
)
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
localeData: JSON.parse( `{
"export": {
"boolTextFalse": "Нет",
"boolTextTrue": "Да"
},
"viewer": {
"toolbar": {
"refresh": "Обновить"
}
}
}`
)
});
localeUri?: string

The url of the file containing the localization strings. Not all strings are necessary — missing values ​​will be displayed using EN localization data.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
localeUri: './locale.json'
});

locale.json:

{
"export": {
"boolTextFalse": "Нет",
"boolTextTrue": "Да",
...
},
"exportcsv": {
"friendlyName": "-CSV-",
"settings": {
"ColumnsDelimiter": {
"label": "Разделитель Столбцов",
"category": "Прочее"
},
...
},
...
},
...
}

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
localeUri: './locale.json'
});

locale.json:

{
"export": {
"boolTextFalse": "Нет",
"boolTextTrue": "Да",
...
},
"exportcsv": {
"friendlyName": "-CSV-",
"settings": {
"ColumnsDelimiter": {
"label": "Разделитель Столбцов",
"category": "Прочее"
},
...
},
...
},
...
}
pageView?: PageViewOptions

Defines horizontal alignment and view for report page like part of the WebPage or 'paper view'

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
pageView: {
horizontalAlignment: 'left',
viewMode: 'standard'
}
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
pageView: {
horizontalAlignment: 'left',
viewMode: 'standard'
}
});
panelsLocation?: PanelsLocation

The position of panels (search, parameters etc): 'toolbar' or 'sidebar'. Default value is 'toolbar'.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
panelsLocation: 'sidebar'
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
panelsLocation: 'sidebar'
});
parametersPanel?: ParametersPanelSettings

Set up the parameters panel settings.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
parametersPanel: {
* location: 'top',
* open: 'always'
}});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
parametersPanel: {
* location: 'top',
* open: 'always'
}});
renderFormat?: RenderFormat

Set up render mode: 'auto', 'html' or 'svg'

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
renderFormat : 'auto'
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
renderFormat : 'auto'
});
renderMode?: RenderMode

Set up initial render mode: 'Paginated' or 'Galley'. Default value is 'Paginated'.

Example: Usage example:

import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
renderMode: 'Galley'
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
renderMode: 'Galley'
});
reportID?: string

The id of the report to be shown by the JS Viewer.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
reportID: 'AnnualReport.rdlx'
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
reportID: 'AnnualReport.rdlx'
});
reportLoaded?: ((reportInfo) => void)

The callback that is invoked when the JS Viewer obtains the information about the requested report.

Type declaration

    • (reportInfo): void
    • Parameters

      Returns void

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
reportLoaded: (reportInfo) => console.log('The report ' + reportInfo.name + ' was successfully loaded!')
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
reportLoaded: (reportInfo) => console.log('The report ' + reportInfo.name + ' was successfully loaded!')
});
reportParameters?: Parameter[]

The array of the {name, value} pairs that describe the parameters values used to run the report.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
reportParameters: [{ name: 'ReportParameter1', values: ['1']}]
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
reportParameters: [{ name: 'ReportParameter1', values: ['1']}]
});
reportService?: ReportServiceSettings

Set up the settings to connect the Web API.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
reportService: {
url: 'http://example.com/api/reporting',
securityToken: '42A9CD80A4F3445A9BB60A221D042FCC',
}
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
reportService: {
url: 'http://example.com/api/reporting',
securityToken: '42A9CD80A4F3445A9BB60A221D042FCC',
}
});
silentPrint?: boolean

JQuery selector that specifies the element that hosts the JS Viewer control.

Example: Usage example:

// ESM usage
import { createViewer } from './jsViewer.min.js';
const viewer = createViewer({
silentPrint: true
});

Example: Usage example:

// UMD usage
var viewer = GrapeCity.ActiveReports.JSViewer.create({
silentPrint: true
});
theme?: UITheme

Viewer's UI theme.

Example: Pre-defined theme selection USM example:

// ESM usage
import {createViewer, UIThemes} from './jsViewer.min.js';
const viewer = createViewer({
element: '#root',
theme: UIThemes.defaultDark
});

Example: Pre-defined theme selection example:

var viewer = GrapeCity.ActiveReports.JSViewer.create({
theme: GrapeCity.ActiveReports.JSViewer.Themes.darkOled
});