Announcement

Collapse
No announcement yet.

Custom Row Action

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

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

    It's the way it's supposed to be done.

    Comment

    Working...
    X