I am using lightning datatable and using the inbuilt checkbox to full fill my bussiness requirement. But I am facing a problem like If I select a row (by selecting the checkbox) then in js by selectedRows feature I am getting which row I have selected that's good. But if I deselect a checkbox of row then selectedRows does not return anything in the js. So how would i know which row I deselected.

Any help highly appreciated.

1 Answer 1


Welcome to StackExchange.

What is your business requirement? Are you trying to fire a different action if the row is unselected?

AFAIK usually the behavior of datatable component selections are loading row ids for the actions that table will perform.

In LWC, there's no two way binding so you can use the getSelectedRows to store and update the only the rows you have stored in your property when an action is called.

Edit: It seems that with aura this is possible with the test I just made below;

table attribute: onrowselection="{!c.atlasTest}"

atlasTest: function(component, event, helper){

  var selectedRows = event.getParam('selectedRows');

If you use onrowselection attribute of the table and use the event selectedRows, this will dynamically list the rows based on your selection. (Probably because aura supports two way binding?)

  • This sounds to me like it would be more appropriate as a comment.
    – Derek F
    Dec 11, 2019 at 12:13

You must log in to answer this question.

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