Creatio development guide
PDF
This documentation is valid for Creatio version 7.15.0. We recommend using the newest version of Creatio documentation.

Adding an action to the list

Glossary Item Box

Overview

Creatio has the possibility to set up a list of actions from the [Actions] menu for selected records of a section.

The list of section actions is an instance of the Terrasoft.BaseViewModelCollection class. Each item of the actions list is a view model.

An action is set up in the configuration object where the properties of the actions view model may be set both explicitly and through the use of the base binding mechanism.

The base content of the [Actions] menu for a section page is implemented in the base class of the BaseSectionV2 section.
The list of section actions returns the getSectionActions protected virtual method from the BaseSectionV2 schema.

A separate action is added to the collection by calling the addItem method.

The getButtonMenuItem callback method is passed to it as a parameter. The method creates an instance of the actions view model by the configuration object passed to it as a parameter.

Example 1. — Base implementation of an action addition

/**
* This returns the actions collection of the section in the list display mode
* @protected
* @virtual
* @return {Terrasoft.BaseViewModelCollection} Actions collection of the section
*/
getSectionActions: function() {
    // List of actions - Terrasoft.BaseViewModelCollection instance
    var actionMenuItems = this.Ext.create("Terrasoft.BaseViewModelCollection"); 
    // Adding an action to the collection. The method instantiating the action
    // model instance by the passed configuration object is passed as callback.  
    actionMenuItems.addItem(
        this.getButtonMenuItem({
        // Configuration object of setting an action.
        })
    );
    return actionMenuItems;
}

Below are the properties of the configuration object of the section action to be passed as a parameter to the getButtonMenuItem method:

Type a type of the [Actions] menu item

A horizontal line for separating the menu blocks may be added to the action menu using this property. For this purpose, the Terrasoft.MenuSeparator string must be specified as the property value. If no property value is specified, the menu item will be added by default.

Caption the title of the [Actions] menu item To set titles, the use of localizable schema strings is recommended.
Click the action handler method is bound in this property by the method name
Enabled a logic property controlling the menu item availability
Visible a logical property controlling the menu item visibility

Procedure for adding a custom action

  1. Override the getSectionActions method.
  2. Add an action to the actions collection using the addItem method.
  3. Pass a configuration object with the added action settings to the getButtonMenuItem callback method.

NOTE

When base sections are replaced in the getSectionActions method of the replacingmodule, the parent implementation of this method must be called first to initialize actions of the parent section.

 

Examples of implementing an action addition

See also:

© Creatio 2002-2020.

Did you find this information useful?

How can we improve it?