function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ferdy Reyes 3Ferdy Reyes 3 

lightning datatable row action blocked by locker

I created a lightning:datatable with static row actions following documentation but for some reason, the actions don't fire. Any idea why?

Below are my code:

datatable:
<lightning:datatable columns="{!v.columns}" data="{!v.data}" keyField="Id" hideCheckboxColumn="true" onRowAction="{!c.handleRowAction}" />

columns:
var actions = [
    {label:'Edit',name:'edit'},
    {label:'Delete',name:'delete'},
    {label:'Close Task',name:'close_task'}
];
cmp.set('v.columns',[
    {label:'Subject', fieldName:'linkName', type:'url',
     typeAttributes:{label:{fieldName:'Subject'}},
     target:'_blank'
    },
    {label:'Status',fieldName:'Status',type:'picklist'},
    {type:'action',typeAttributes:{rowActions:actions}}
]);

handleRowAction:
handleRowAction : function(cmp,evt,hlpr) {
    var action = evt.getParam('action');
    var row = evt.getParam('row');
    switch(action.name) {
        case 'edit':
            alert('edit');
            break;
        case 'delete' :
            console.log('delete '+row.Id);
            break;
        case 'close_task' :
            alert('close '+row.Id);
            break;
    }

}

​​​​​​​​​​​​​​
Best Answer chosen by Ferdy Reyes 3
Khan AnasKhan Anas (Salesforce Developers) 
Hi Ferdy,

Greetings to you!

You are using onRowAction attribute instead of onrowaction on lightning:datatable component. As lightning is based on aura framework which is a type of JavaScript and JavaScript is case sensitive so lightning is case sensitive.

Change it to:
<lightning:datatable columns="{!v.columns}" data="{!v.data}" keyField="Id" hideCheckboxColumn="true" onrowaction="{!c.handleRowAction}" />

Please refer to below link for more information:

https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/example#lightningcomponentdemo:exampleDatatableStaticRowActions

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas