+ Start a Discussion
Philip BonthaPhilip Bontha 

Hi Experts, I need navigation button between two datatables in lightning.If i click the button it should have navigate to previous datatable.

There are two objects parent and child.The parent data is displying in one datatable along with checkboxes to select the records,If i selected one parent record and click the serach button it navigate the child records datatable.There I want to create one Back button to navigate previous parent datatable.

Thanks in advance..!

Philip
ANUTEJANUTEJ (Salesforce Developers) 
Hi Philip,

I found the below example where it shows a way to navigate without refreshing the browser, below is the link to that implementation: 

>> https://sfdc.danielzeidler.com/2019/12/19/integrating-the-browsers-back-and-forward-buttons-in-a-lightning-web-component/

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
AnudeepAnudeep (Salesforce Developers) 
In general navigation requires a pagereference/hyperlink 

Here is an example
 
var navService = cmp.find("navService");

// Sets the route to /lightning/o/Account/home
var pageReference = {
    type: 'standard__objectPage',
    attributes: {
        objectApiName: 'Account',
        actionName: 'home'
    }
};
cmp.set("v.pageReference", pageReference);

The same can be done in datatable as well

Here are some examples that you can look at

https://www.infallibletechie.com/2018/07/how-to-hyperlink-record-in.html

http://simpluslabs.com/how-to-use-lightningnavigation-to-navigate-another-component/

https://salesforce.stackexchange.com/questions/283093/how-to-navigate-to-records-using-datatable-in-lightning-web-components

https://salesforce.stackexchange.com/questions/257065/hyperlink-record-name-lwc-datatable

Let me know if this helps, if it does, please close the query by marking it as solved. It may help others in the community. Thank You!