IPreviewModel Interface
Provides information a client-side Document Preview model.
Declaration
interface IPreviewModel
Remarks
The IPreviewModel object is returned by the following methods:
Properties
Close Property
Closes the document which is currently opened in the Web Document Viewer.
Declaration
Close: () => void
Property Value
Type | Description |
---|---|
() => void | An action that closes the document which is currently opened in the Web Document Viewer. |
ExportTo Property
Exports the document to a specified file format.
Declaration
ExportTo: (format?: string, inlineResult?: boolean) => void
Property Value
Type | Description |
---|---|
(format?: string, inlineResult?: boolean) => void | An action that exports the document. |
Remarks
Once the document export has started, it will run until the resulting document is complete and cannot be interrupted or canceled in the process.
The following formats are currently supported: ‘csv‘, ‘html‘, ‘image‘, ‘mht‘, ‘pdf‘, ‘rtf‘, ‘docx‘, ‘txt‘, ‘xls‘, and ‘xlsx‘.”
If the inlineResult parameter is set to true, but a file format is not supported by your browser, the resulting file will be downloaded.
GetCurrentPageIndex Property
Returns the current page’s zero-based index.
Declaration
GetCurrentPageIndex: () => number
Property Value
Type | Description |
---|---|
() => number | A zero-based integer value that specifies the index of a current page. |
Remarks
The code snippet below demonstrates how to use the ASPxClientReportDesigner.PreviewDocumentReady event to navigate through pages of a ready document. To obtain the current page number and navigate to the next page, use the GetCurrentPageIndex and GoToPage methods.
<script type="text/javascript" id="script">
function previewDocumentReady(s, e) {
var previewModel = s.GetPreviewModel();
var goToNextPage = function () {
var pageIndex = previewModel.GetCurrentPageIndex();
if (e.PageCount <= pageIndex)
return;
previewModel.GoToPage(pageIndex + 1);
setTimeout(function () { goToNextPage(); }, 3000);
}
goToNextPage();
}
</script>
<dx:ASPxReportDesigner ID="ASPxReportDesigner1" runat="server">
<ClientSideEvents PreviewDocumentReady="previewDocumentReady"/>
</dx:ASPxReportDesigner>
GetParametersModel Property
Provide access to the report parameters’ client-side model.
Declaration
GetParametersModel: () => Parameters.PreviewParametersViewModel
Property Value
Type | Description |
---|---|
() => PreviewParametersViewModel | An action that returns the report parameters’ client-side model. |
GoToPage Property
Displays the report page with the specified page index.
Declaration
GoToPage: (pageIndex: number) => void
Property Value
Type | Description |
---|---|
(pageIndex: number) => void | A zero-based integer value that specifies the index of a page to be displayed. |
Remarks
The code snippet below demonstrates how to use the ASPxClientReportDesigner.PreviewDocumentReady event to navigate through pages of a ready document. To obtain the current page number and navigate to the next page, use the IPreviewModel.GetCurrentPageIndex and GoToPage methods.
<script type="text/javascript" id="script">
function previewDocumentReady(s, e) {
var previewModel = s.GetPreviewModel();
var goToNextPage = function () {
var pageIndex = previewModel.GetCurrentPageIndex();
if (e.PageCount <= pageIndex)
return;
previewModel.GoToPage(pageIndex + 1);
setTimeout(function () { goToNextPage(); }, 3000);
}
goToNextPage();
}
</script>
<dx:ASPxReportDesigner ID="ASPxReportDesigner1" runat="server">
<ClientSideEvents PreviewDocumentReady="previewDocumentReady"/>
</dx:ASPxReportDesigner>
OpenReport Property
Opens the specified report on the Web Document Viewer’s client side.
Declaration
OpenReport: (reportUrl: string) => void
Property Value
Type | Description |
---|---|
(reportUrl: string) => void | Specifies the URL of a report to be opened. |
Print Property
Prints the document’s page with the specified index.
Declaration
Print: (pageIndex?: number) => JQueryPromise<boolean>
Property Value
Type |
---|
(pageIndex?: number) => JQueryPromise<boolean> |
Remarks
This method prints only one document page with the specified index. You can also call this method without parameter to print the entire document.
The printing functionality of the Web Document Viewer is based on rendering the report in PDF with special settings and invoking the PDF plug-in’s Print dialog.
After the Print method is called, the Document Viewer tries to use the PDF plug-in of the web browser to print. Depending on the plug-in detection result, there are two possible scenarios.
- If the PDF plug-in is installed and enabled, its Print dialog is invoked. To print the document, specify the required settings in this dialog and click Print.
- If the PDF plug-in is disabled or is not installed, the Document Viewer exports the report document to a PDF file, and initiates its download instead of printing. The resulting PDF file contains a script that starts printing the document immediately after it is opened in a compatible viewer.
reportPreview Property
Provides access to the report preview.
Declaration
reportPreview: ReportPreview
Property Value
Type | Description |
---|---|
ReportPreview | A report preview. |
ResetParameters Property
Resets the report parameter values to the default values.
Declaration
ResetParameters: () => void
Property Value
Type | Description |
---|---|
() => void | An action that resets the report parameter values to the default values. |
Remarks
After default values of report parameters have been restored, the ASPxClientWebDocumentViewer.ParametersReset or ASPxClientReportDesigner.PreviewParametersReset event occurs.
StartBuild Property
Starts building a report document.
Declaration
StartBuild: () => void
Property Value
Type | Description |
---|---|
() => void | An action that starts building a report document. |
tabPanel Property
Provides access to a panel at the right of the Document Viewer.
Declaration
tabPanel: Analytics.Utils.TabPanel
Property Value
Type | Description |
---|---|
TabPanel | The tab panel. |
Remarks
The tabPanel property provides access to the panel containing tabs with the Document Map, Parameters, Search Options and Export Options.
The code sample below demonstrates how to automatically collapse this panel after resetting parameter values in the ASPxClientReportDesigner.PreviewParametersReset event handler.
<script type="text/javascript" id="script">
function previewParametersReset(s, e) {
var preview = s.GetPreviewModel();
if (preview) {
preview.tabPanel.collapsed(true);
}
}
</script>
<dx:ASPxReportDesigner ID="ASPxReportDesigner1" runat="server">
<ClientSideEvents PreviewParametersReset="previewParametersReset"/>
</dx:ASPxReportDesigner>