Custom Row Action

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SoBeGuy
    Member
    • Jan 2024
    • 63

    Custom Row Action

    I created a custom row action using the following code to extend the RowActionHandler class:

    Code:
    define(['handlers/row-action'], function (RowActionHandler) {
        class CustomRowActionHandler extends RowActionHandler {
            actionPlacementCancel(data) {
                console.log('Cancel Placement clicked for record:', data.id);
            }
        }
        return CustomRowActionHandler;
    });
    ​
    However, it doesn't work. Nothing is logged when I click the PlacementCancel button.

    I can make it work by explicitly overriding the process method:

    Code:
    define(['handlers/row-action'], function (RowActionHandler) {
        class CustomRowActionHandler extends RowActionHandler {
            actionPlacementCancel(data) {
                console.log('Cancel Placement clicked for record:', data.id);
            }
            process(model, action) {
                if (action === 'PlacementCancel') {
                    this.actionPlacementCancel(model);
                } else {
                    super.process(model, action);
                }
            }​
        }
        return CustomRowActionHandler;
    });
    ​


    Is it possible to make it route directly to the action without overriding the process method? I would think that Espo's routing could handle this automatically.
  • yuri
    Member
    • Mar 2014
    • 8627

    #2
    > I can make it work by explicitly overriding the process method

    It's the way it's supposed to be done.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...