import { LightningElement, wire, track,api } from 'lwc'; import { NavigationMixin } from 'lightning/navigation'; import getAccounts from '@salesforce/apex/MyAccounts.getAccounts'; export default class LightningDatatableLWCExample extends NavigationMixin(LightningElement) { @track columns = [ { label: 'Account Name', fieldName: 'Name', type: 'text', sortable: true }, { label: 'Phone', fieldName: 'Phone', type: 'phone', sortable: true } ]; @track error; @track data; @wire(getAccounts) wiredAccounts({ error, data }) { if (data) { this.data = data; } else if (error) { this.error = error; } } handleRowAction(event) { const selectedRecord =event.detail.row.Id; console.log('@@@@@@ getting selected id: '+selectedRecord); this[NavigationMixin.Navigate]({ type: 'standard__recordPage', attributes: { recordId: selectedRecord, objectApiName: 'Account', actionName: 'view' } }); } }