Skip to main content
All docs
V26.1
  • ASPxClientRichEditViewTypeChangedEventHandler Interface

    A method that handles the ViewTypeChanged event.

    Declaration

    interface ASPxClientRichEditViewTypeChangedEventHandler {(source: ASPxClientRichEdit, e: ASPxClientRichEditViewTypeChangedEventArgs): any;}

    Parameters

    Name Type Description
    source ASPxClientRichEdit

    The event source.

    e ASPxClientRichEditViewTypeChangedEventArgs

    An object that contains event data.

    Remarks

    The ViewTypeChanged event fires after the document view type changes:

    • A user selects a view in the ribbon’s View tab.
    • The ChangeViewType command is executed.

    Handle this event to update your application’s UI or logic based on the current view type. Use the e.viewType property to obtain the new view type. The property returns a number that corresponds to a ViewType enumeration value.

    Event arguments do not include the previous view type. You cannot cancel the view type change in the event handler.

    The event does not fire in the following cases:

    • The new view type matches the current one (for example, when you call the execute method and pass the active view type as a parameter).
    • The component applies the initial view type on load.

    The following code snippet logs the new view type to the browser console:

    richEdit.ViewTypeChanged.AddHandler(function (s, e) {
        if (e.viewType === 1)
            console.log('Print Layout view');
        else
            console.log('Simple view');
    });