0

I have a lightning community setup and a custom record detail page.

On the record detail page, I have put a tabset on the page (managed from the community Builder not developer console).

I have then placed a lightning component on that same page with some actions on it.

Is it possible to click a button on the lightning component to then change the tabs on the page?

In the photo below, if I click "Upload here", I want it to focus the "Upload Files" tab.

I'd prefer not to use a custom component because I have the page layout of the record under details.

The tabs do send through anchor links. Tab 2 appends the url with ?tabset-38917=2

Photo

0

You have 2 options to achieve your requirement.

1) Fire an application event from the top component and let the below component handle the application event and focus on the upload files tab. This would require creating an application event, firing the event and handling the event. (I have assumed that both are custom lightning components)

Documentation: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_application.htm

2) On click of the upload files button you can navigate to the same page by appending "?tabset-38917=2" in the current url

    handleClick: function(cmp, event, helper) {
        var navService = cmp.find("navService");


        var pageReference = {    
                              "type": "standard__webPage",
                              "attributes": {
                                              "url": "your page url" + "?tabset-38917=2"
                               }
                             }
        event.preventDefault();
        navService.navigate(pageReference);
    } 

Documentation Reference: https://developer.salesforce.com/docs/component-library/bundle/lightning:navigation/documentation

  • That does work, but it reloads the entire page. Where the tabs are is a standard component inside the Community builder. I guess I could build it by hand inside the custom component above, but I'd have to manually create a page layout instead of the standard one that does it for me in the community – DCole Oct 1 '19 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.