You need to sign in to do that
Don't have an account?
Yogendra Jangid
How to capture standard showtoast event in lwc
I am writing a custom listner to lightning showtoast in my lwc application.
this works fine when I fire the toast event explicitly via code. But when I use the lightning navigation, the standard toast events are fired.
Pop up is opened through the Navigation
Does anyone have any idea how to make it work for standard toast events as well.
constructor() { super(); this.addEventListener('lightning__showtoast', this.handleNotification); } handleNotification() { //do something here }
this works fine when I fire the toast event explicitly via code. But when I use the lightning navigation, the standard toast events are fired.
Pop up is opened through the Navigation
navigateToRecordEditPage(event, recordId) { event.preventDefault(); this[NavigationMixin.Navigate]({ type: 'standard__recordPage', attributes: { recordId: recordId, objectApiName: this.records.relatedSobjectApiName, actionName: 'edit' } }); }Once the records are saved, the toast event is fired but same is not caught in the handler created.
Does anyone have any idea how to make it work for standard toast events as well.
All Answers
I am experiencing the same issue, were you able to find a solution for this?