Skip to main content

IWizardEvents<Sender> Interface

The wizard’s event collection.

Declaration

export interface IWizardEvents<Sender>

Type Parameters

Name Description
Sender

A sender object.

Remarks

The following table lists wizard events and describes how you can use them to customize the wizard.

Wizard Event

Description

beforeInitialize

Occurs before the FullscreenReportWizard.initialize/FullscreenDataSourceWizard.initialize method is called.

Handle this event to customize the predefined settings for the wizard’s global state. For instance, you can change the default page settings, the default report type, etc.

afterInitialize

Occurs after the FullscreenReportWizard.initialize/FullscreenDataSourceWizard.initialize method is called.

Handle this event to change the page count and/or sequence. For instance, you can remove a specific wizard page or register a new page.

beforePageInitialize

Occurs before the page’s initialize method is called.

Handle this event to customize the page’s content and state. For instance, you can remove a specific element from the start page or remove a specific section from other pages.

afterPageInitialize

Occurs after the page’s initialize method is called.

Handle this event to customize the page’s settings for display in the UI.

beforeFinish

Occurs before the wizard’s onFinish method is called.

Handle this event to customize the resulting wizard settings and generate a report/data source based on them. For instance, you can specify your custom report title if a user did not specify it.

afterFinish

Occurs after the wizard’s onFinish method is called.

Handle this event to customize the generated report. For instance, you can change the report name and display name.

See the following topics for more information:

Properties

afterFinish Property

Occurs after the wizard’s onFinish method is called.

Declaration

"afterFinish": IAfterWizardFinishEventArgs

Property Value

Type Description
IAfterWizardFinishEventArgs

The event’s arguments.

Remarks

Handle this event to customize the generated report. Use the event argument’s wizardResult to access the generated report and customize its properties. Use the state property to read values from the global state.

The following example demonstrates how to:

  • specify your custom report title if a user did not specify it;
  • update the resulting report’s name and display name based on the report title.
<script type="text/javascript">
    function beforeFinish(s) {          
        if(!s.wizardModel.ReportTitle) {
            s.wizardModel.ReportTitle = "My Report"
            s.state.reportTitle = "My Report "
        }
    }
    function afterFinish(s) {
        s.wizardResult.name(s.state.reportTitle.replace(/ /g, ""))
        s.wizardResult.displayName(s.state.reportTitle)
    }
    function CustomizeWizard(s, e) {
        if(e.Type === "ReportWizard") {
            e.Wizard.events.addHandler("beforeFinish", beforeFinish)
            e.Wizard.events.addHandler("afterFinish", afterFinish)
        }
    }
</script>

<dx:ASPxReportDesigner ID="ASPxReportDesigner9" runat="server">
    <ClientSideEvents CustomizeWizard="CustomizeWizard" />
</dx:ASPxReportDesigner>

The resulting report:

See the following topics for more information:

afterInitialize Property

Declaration

"afterInitialize": IWizardEventArgs<Sender>

Property Value

Type Description
IWizardEventArgs<Sender>

The event’s arguments.

Remarks

Handle this event to change the page count and/or sequence. For instance, you can remove a specific wizard page or register a new page.

The following example demonstrates how to hide the Select Data Source page from the Report Wizard and enable users to create SQL data sources only.

<script type="text/javascript">
   function beforeInit(args) {
       args.state.dataSourceType = 1;
   }

   function afterInit(args) {
       // Remove the "Select Data Source" page's metadata from the factory.
       args.wizard.pageFactory.unregisterMetadata(DevExpress.Reporting.Designer.Wizard.FullscreenReportWizardPageId.SelectDataSourcePage);
       // Override the navigation logic to skip the "Select Data Source" page.
       var defaultGetNextPageId = args.wizard.iterator.getNextPageId;
       args.wizard.iterator.getNextPageId = function (pageId) {
           if (pageId === DevExpress.Reporting.Designer.Wizard.FullscreenReportWizardPageId.SelectReportTypePage) {
               return DevExpress.Reporting.Designer.Wizard.FullscreenReportWizardPageId.SpecifySqlDataSourceSettingsPage;
           } else {
               return defaultGetNextPageId.apply(this, [pageId]);
           }
       }
   }

   function CustomizeWizard(s, e) {
       if (e.Type === "ReportWizard") {
           e.Wizard.events.addHandler("beforeInitialize", beforeInit)
           e.Wizard.events.addHandler("afterInitialize", afterInit)
       }
   }
</script>

<dx:ASPxReportDesigner ID="ASPxReportDesigner2" runat="server">
    <ClientSideEvents CustomizeWizard="CustomizeWizard" />
</dx:ASPxReportDesigner>

The resulting Report Wizard:

See the following topics for more information:

afterPageInitialize Property

Occurs after the page’s initialize method is called.

Declaration

"afterPageInitialize": IWizardPageEventArgs<Sender>

Property Value

Type Description
IWizardPageEventArgs<Sender>

The event’s arguments.

Remarks

Handle this event to customize the page’s settings for display in the UI.

beforeFinish Property

Occurs before the wizard’s onFinish method is called.

Declaration

"beforeFinish": IBeforeWizardFinishEventArgs

Property Value

Type Description
IBeforeWizardFinishEventArgs

The event’s arguments.

Remarks

Handle this event to customize the resulting wizard settings and generate a report/data source based on them.

Use the event argument’s wizardModel property to customize the wizard settings. These settings are sent to the server side to generate a report/data source. Use the event argument’s state property to read specific values that a user entered on wizard pages or to pass the updated wizard settings to the afterFinish event.

The following example demonstrates how to:

  • specify your custom report title if a user did not specify it;
  • update the resulting report’s name and display name based on the report title.
<script type="text/javascript">
    function beforeFinish(s) {          
        if(!s.wizardModel.ReportTitle) {
            s.wizardModel.ReportTitle = "My Report"
            s.state.reportTitle = "My Report "
        }
    }
    function afterFinish(s) {
        s.wizardResult.name(s.state.reportTitle.replace(/ /g, ""))
        s.wizardResult.displayName(s.state.reportTitle)
    }
    function CustomizeWizard(s, e) {
        if(e.Type === "ReportWizard") {
            e.Wizard.events.addHandler("beforeFinish", beforeFinish)
            e.Wizard.events.addHandler("afterFinish", afterFinish)
        }
    }
</script>

<dx:ASPxReportDesigner ID="ASPxReportDesigner9" runat="server">
    <ClientSideEvents CustomizeWizard="CustomizeWizard" />
</dx:ASPxReportDesigner>

The resulting report:

See the following topics for more information:

beforeInitialize Property

Declaration

"beforeInitialize": IBeforeWizardInitializeEventArgs<Sender>

Property Value

Type Description
IBeforeWizardInitializeEventArgs<Sender>

The event’s arguments.

Remarks

Handle this event to customize the predefined settings for the wizard’s global state. For instance, you can change the default page settings, the default report type, etc.

The following code sample demonstrates how to change the Report Wizard’s default page size and orientation.

<script type="text/javascript">
    function beforeInit(args) {
        // Customize the default page size and orientation.
        args.state.pageSetup.paperKind = "A4";
        args.state.pageSetup.landscape = true;
    }

    function CustomizeWizard(s, e) {
        if (e.Type === "ReportWizard") {
            e.Wizard.events.addHandler("beforeInitialize", beforeInit)
        }
    }
</script>

<dx:ASPxReportDesigner ID="ASPxReportDesigner1" runat="server">
    <ClientSideEvents CustomizeWizard="CustomizeWizard" />
</dx:ASPxReportDesigner>

The resulting Specify Page Settings page:

See the following topics for more information:

beforePageInitialize Property

Occurs before the page’s initialize method is called.

Declaration

"beforePageInitialize": IBeforeWizardPageInitializeEventArgs<Sender>

Property Value

Type Description
IBeforeWizardPageInitializeEventArgs<Sender>

The event’s arguments.

Remarks

Handle this event to customize the page’s content and state. For instance, you can remove a specific element from the start page or remove a specific section from other pages.

The following example demonstrates how to hide the Select Data Source page’s section that displays available data source.

<script type="text/javascript">
   function beforePageInit(args) {
       // Identify the "Select Data Source" page.
       if (args.pageId === DevExpress.Reporting.Designer.Wizard.FullscreenReportWizardPageId.SelectDataSourcePage) {
           // Remove the page's section that displays available data sources.
           args.page.unregisterSection(DevExpress.Reporting.Designer.Wizard.FullscreenReportWizardSectionId.ChooseAvailableDataSourcePage);
           // Make the "Select data source type" section occupy the entire page.
           args.page.setSectionPosition(DevExpress.Reporting.Designer.Wizard.FullscreenReportWizardSectionId.ChooseDataSourceTypePage);
           // Override the navigation logic to skip the removed section.
           args.page.getNextSectionId = function(sectionId) {
               if(!sectionId) return DevExpress.Reporting.Designer.Wizard.FullscreenReportWizardSectionId.ChooseDataSourceTypePage;
           }
       }
   }

   function CustomizeWizard(s, e) {
       if(e.Type === "ReportWizard") {
           e.Wizard.events.addHandler("beforePageInitialize", beforePageInit)
       }
   }
</script>

<dx:ASPxReportDesigner ID="ASPxReportDesigner3" runat="server">
    <ClientSideEvents CustomizeWizard="CustomizeWizard" />
</dx:ASPxReportDesigner>

The resulting Select Data Source page:

See the following topics for more information:

beforeStart Property

For internal use.

Declaration

"beforeStart": IWizardEventArgs<Sender>

Property Value

Type
IWizardEventArgs<Sender>