From the ligtning:datatable documentation, a helper function can be called from the controller that adds the relevant row-level actions. Copied here...


 init: function (cmp, event, helper) {
     var actions = helper.getRowActions.bind(this, cmp);
     cmp.set('v.mycolumns', [
         // Other column data here
         { label: 'State', fieldName: 'active', type: 'text' },
         { type: 'action', typeAttributes: { rowActions: actions } }
     // Fetch or set your data


getRowActions: function (cmp, row, doneCallback) {
    var actions = [];
    if (row['isActive']) {
            'label': 'Deactivate',
            'iconName': 'utility:block_visitor',
            'name': 'deactivate'
    } else {
            'label': 'Activate',
            'iconName': 'utility:adduser',
            'name': 'activate'
    // simulate a trip to the server
    setTimeout($A.getCallback(function () {
    }), 200);

I'd like to reference some other helper functions from within the getRowActions helper function but the example doesn't pass the helper in and also this that would normally resolve to the helper is undefined.

Is there a solution?

1 Answer 1


You need a reference to the helper. Despite what the documentation says, I'd prefer to bind to the helper, since the controller doesn't have a "this", which is done to prevent accidentally storing data on the component.

var actions = helper.getRowActions.bind(helper, cmp);

This will set this to the helper, and you can then call other methods normally using this.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .