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
Aashish Rana 15Aashish Rana 15 

This page has an error. You might just need to refresh it. First, would you give us some details? (We're reporting this as error ID: 1773372238)

getting this error while navigating to record page throug view action. "This page has an error. You might just need to refresh it. First, would you give us some details? (We're reporting this as error ID: 1773372238)"

Can you please help me to find the bug

.js:-


import { LightningElement, track, api } from 'lwc';
import getplayer from '@salesforce/apex/playerdemo.getplayer';
import assignclubcaptain from '@salesforce/apex/playerdemo.assignclubcaptain';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import {NavigationMixin} from 'lightning/navigation';
const actions=[
                 {label:'Assign',name:'assign'},
                 {label:'View',name:'view'},
]
const columns=[
                 {label:'Player Name',fieldName:'Name'},
                 {label:'Player Id',fieldName:'Id'},
                 {
                    type:'action',
                    typeAttributes : {rowActions:actions},
                },
]
export default class Datatablewithrawaction extends LightningElement {
   @track data=[];
   @track columns=columns;
   @track buttonvalue='Show';
   @track cardvisible=false;
   @api recordId;
   @track playerdata=[];
   
   
   connectedCallback(){
    getplayer({fid:this.recordId})
    .then(result=>{
        this.data=result;
    })
    .catch(error=>{
    })
   }
   
   handleclick(event){
       const lab=event.target.label;
       if(lab==='Show'){
        this.cardvisible=true;
        this.buttonvalue='Hide';
       }
       else if(lab==='Hide'){
        this.cardvisible=false;
        this.buttonvalue='Show';
       }
   }
   handleRowAction(event){
    const actionName=event.detail.action.name;
    const row=event.detail.row;
    switch(actionName){
        case'assign':this.assignCaptain(row);
        break;
        case'view' :this.navigateToPlayerRecordPage(row);
        break;
        default:
    }
   }
   assignCaptain(currentRow){
     const selectedRow= currentRow;
     assignclubcaptain({lwcrowid:selectedRow.Id})
     .then(result=>{
        this.playerdata=result;
     })
     this.showSuccessToast();
     window.location.reload;
   }
   showSuccessToast(){
         const event= new ShowToastEvent({
            label:'Record Updated',
            message:'Captain assignment successfully',
            variant:'success',
            mode:'dismissable'
         });
         this.dispatchEvent(event);
   }
   navigateToPlayerRecordPage(rowData){
      const player= rowData;
      this[NavigationMixin.Navigate]({
        type: 'standard_recordPage',
        attribute:{
                  recordId:player.Id,
                  actionName:'view'
        }
      })
   }
}
===============================================================
.html:-

<template>
    <lightning-button variant="brand" label={buttonvalue} onclick={handleclick}></lightning-button>
    <template if:true={cardvisible}>
           <lightning-card title="Players Name">
                  <lightning-datatable  key-field="id"
                                        data={data}
                                        columns={columns}
                                        onrowaction={handleRowAction}
                                        hide-checkbox-column></lightning-datatable>
           </lightning-card>
    </template>
</template>

Shivdeep KumarShivdeep Kumar
Hi Aashish,

Please change the class from 
export default class Datatablewithrawaction extends LightningElement {}

to 

export default class Datatablewithrawaction extends NavigationMixin(LightningElement){}

Please let me know if this help!

Thanks,
Shivdeep Kumar