ASPxClientWebDocumentViewer.CustomizeMenuActions Event
Enables you to customize the Web Document Viewer’s toolbar commands.
Namespace: DevExpress.XtraReports.Web.Scripts
Assembly: DevExpress.XtraReports.v18.2.Web.Scripts.dll
Declaration
public event ASPxClientWebDocumentViewerCustomizeMenuActionsEventHandler CustomizeMenuActions
Event Data
The CustomizeMenuActions event's data class is ASPxClientCustomizeMenuActionsEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Actions | Provides access to the collection of actions available in the toolbar and menu. |
The event data class exposes the following methods:
Method | Description |
---|---|
GetById(String) | Returns a menu action with the specified ID. |
Remarks
The event argument provides access to the Actions collection that contains all the available Document Viewer commands. You can add new commands to the collection and modify the existing commands. To obtain an existing command, call the event argument’s GetById method and pass the command ID as a parameter.
The following example demonstrates how to hide the existing Highlight Editing Fields toolbar command and add a new Run Slide Show command that navigates through document pages.
<script type="text/javascript">
function customizeMenuAction(s, e) {
// Get the "Highlight Editing Fields" action and hide it.
var highlightEditingFieldsAction = e.GetById(DevExpress.Report.Preview.ActionId.HighlightEditingFields);
if (highlightEditingFieldsAction)
highlightEditingFieldsAction.visible = false;
// Add a new action.
var interval;
var selected = ko.observable(false);
e.Actions.push({
text: "Run Slide Show",
imageTemplateName: "slideshow",
visible: true,
disabled: false,
selected: selected,
hasSeparator: false,
hotKey: { ctrlKey: true, keyCode: "Z".charCodeAt(0) },
clickAction: function () {
if (selected()) {
clearInterval(interval);
selected(false);
return;
}
var model = s.GetPreviewModel();
if (model) {
selected(true);
interval = setInterval(function () {
var pageIndex = model.GetCurrentPageIndex();
model.GoToPage(pageIndex + 1);
}, 2000);
}
}
});
}
</script>
<dx:ASPxWebDocumentViewer ID="ASPxWebDocumentViewer1" runat="server">
<ClientSideEvents CustomizeMenuActions="customizeMenuAction" />
</dx:ASPxWebDocumentViewer>
See the following topics for more information:
- Customize the Document Viewer Toolbar (ASP.NET WebForms)
- Customize the Document Viewer Toolbar (ASP.NET MVC)