If I extends a base lightning-datatable like this Lifecycle hooks in the extended LWC will not work when the Base Component is calling connectedCallback.

connectedCallback will be called but clicking a row acation will not invoke handleRowAction.



my-datatable.js (with problematic connectedCallback)

import LightningDatatable from 'lightning/datatable';

export default class MyTable extends LightningDatatable {
    connectedCallback() {

the handleRowActions (or other lifecycle hooks) will not be called


    <c-mytable key-field="id"


import { LightningElement, track } from 'lwc';

export default class MyPage extends LightningElement {


    handleRowAction(event) {
  • 3
    Have you tried invoking the base class's connectedCallback, from within your own, like super.connectedCallback()?
    – Phil W
    Nov 10, 2020 at 14:30
  • Awesom this works! Would you mind making this an answer with some documentation reference and explanation? Nov 10, 2020 at 14:38

1 Answer 1


The LWC lifecycle hooks are simply methods from the LightningElement which can be implemented at any level within the LWC inheritance hierarchy. It happens that the lightning-datatable itself makes use of the connectedCallback to perform necessary setup, including wiring up the row action handling.

If you override such a method in an LWC that is itself already implementing it you have to provide all the processing done in the superclass in your own implementation as well as your own processing. The easiest way to achieve this is to simply "augment" the method by calling the super class's version of the method then doing your own thing (it is usually best to do the super class call first for consistency and to avoid doing any processing of your own if the super class would barf).

In this case you simply need:

    connectedCallback() {
        // Allow the super class to do what it wants to do first

        // Now do the special processing needed here

In terms of documentation, sadly the lifecycle hook docs fail to mention this aspect, and the lightning-datatable documentation also fails to mention the fact that it implements the connectedCallback.

The rule of thumb is that if you ever inherit from anything other than LightningElement, treat it as a black box and always call the super versions of the lifecycle hook methods "just in case".


You must log in to answer this question.

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