If you implement a custom template service, the defineTemplateAction method enables you to define a custom action that can be applied to diagram templates displayed in the editor's template selection window. Each custom action you define will result in a new action button displayed under the template preview area of the template selector. Up to 3 template actions may be defined.
.defineTemplateAction( /*String*/ label, /*Function*/ actionFunction)
A string that will be used as the action button's label.
A function that accepts two parameters.
This function will be called when the user invokes the template action.
Note: only 3 template actions may be defined. Attempting to add more than 3 will result in an exception.
This method must be used before the startup method is called. defineTemplateAction will throw an exception if called after startup.
editor = new ESDWeb(null, 'editorNode'); editor.defineTemplateAction('Delete', function (templateId, refresh) { // Delete template server-side via an ajax request. ... // refresh the template manager window refresh(); }); // Startup the editor with templateServiceUrl enabled. editor.startup({ ... templateServiceUrl: 'http://www.example.com/REST/' });