JavaScript/jQuery Diagram - mainToolbar.commands
The main toolbar can contain default and custom commands. Handle the CustomCommand event to respond to a custom command click.
jQuery
JavaScript
$(function() { var diagram = $("#diagram").dxDiagram({ mainToolbar: { visible: true, commands: ["fontName", "fontSize", "bold", "italic", "underline", {name: "sayHello", text: "Say Hello", icon: "blockquote"}] }, onCustomCommand: function(e) { if (e.name == "sayHello") alert("Hello!") }, }).dxDiagram("instance"); });
icon
Type:
This property accepts one of the following:
- The icon's URL
- The icon's name if the icon is from the DevExtreme icon library
- The icon's CSS class if the icon is from an external icon library (see External Icon Libraries)
- The icon in the Base64 format
- The icon in the SVG format. Ensure that the source is reliable.
location
Type:
Default Value: 'before'
NOTE
This property does not allow you to set the location of the command or separator in the context menu, and history and view toolbars.
Refer to the following section for more information: Specify a Command's Location on the Main Toolbar.
Feedback