Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a vertical navigation to show/hide a div container that display respective selected contents when clicking on the list of links Uses of “lightning-vertical-navigation” elements in Salesforce Lightning Web Component — LWC #52

Open
vijayk3327 opened this issue Jul 14, 2023 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@vijayk3327
Copy link
Owner

In this post we are going to learn about How to build a vertical navigation to show/hide a div container that display respective selected contents when clicking on the list of links Uses of “lightning-vertical-navigation” elements in Salesforce Lightning Web Component — LWC.

→ Get source code live demo link:-

Step 1:- Create Lightning Web Component : lwcVerticalNavigation.html

`

Create Vertical Navigation in Lightning Web Component (LWC)


    <lightning-layout-item padding="around-medium">
        <h2 class="slds-section-title--divider" style="background:#eee; margin-bottom:10px;"><strong>You Are Viewing: <span style="color:#0000ff;">{currentContent}</span></strong></h2>

        <template if:true={tutorialValue}>                      
            <div class="tabContent">                        
                <div class="postImage">					
                    <a href="https://www.w3web.net/if-and-else-condition-in-lwc/" target="_blank" rel="noopener noreferrer">
                        <img src="https://www.w3web.net/wp-content/uploads/2020/08/aboutus.png" width="300" height="200"></img>
                    </a>
                </div> 
                <div class="imgRt"> 
                <h3 class="slds-text-heading_small slds-text-color--error"><strong>Tutorial W3web</strong></h3> 
                <p class="titleTag"><b><a href="https://www.w3web.net/if-and-else-condition-in-lwc/" target="_blank" rel="noopener noreferrer">Easy to learn step-by-step online Salesforce tutorial from w3web.net</a></b></p>
                <p><strong>w3web.net</strong> is the place where you can learn step-by-step about Blog, WordPress, Salesforce Lightning Component, Lightning Web Component (LWC),</p>                     
                <p>Visualforce, Technical of Computer Application, Salesforce Plugin, JavaScript, Jquery, CSS, Computer & Accessories, Software Configuration, Customization, Development and much<span class="readMore"><a href="https://www.w3web.net/if-and-else-condition-in-lwc/" target="_blank" rel="noopener noreferrer"> more →</a></span></p>
                </div>    
            </div>
        </template>

        <template if:true={integrationValue}>
            <div class="tabContent">                        
                <div class="postImage">					
                    <a href="https://www.w3web.net/create-node-rest-api-to-insert-update-delete-from-soql/" target="_blank" rel="noopener noreferrer">
                        <img src="https://www.w3web.net/wp-content/uploads/2021/09/nodeApiFeature.png" width="300" height="200"></img>
                    </a>
                </div> 
                <div class="imgRt"> 
                <h3 class="slds-text-heading_small slds-text-color--error"><strong>REST API Integration</strong></h3> 
                <p class="titleTag"><b><a href="https://www.w3web.net/create-node-rest-api-to-insert-update-delete-from-soql/" target="_blank" rel="noopener noreferrer">How to insert, update, retrieve and Delete Record from Node js Rest Api Using Express JS, pool, pg module and localserver in Salesforce (SOQL).</a></b></p>
                <p>Create Node js Rest Api to get, insert, update and delete records from SOQL Using.</p>                     
                <p>Today in this post we are going to learn about How to Create Node js Rest Api to get, insert, update and delete records from SOQL Using Express JS, Install pool database, Install pg and Install localserver to Start port terminal and project structure setup.<span class="readMore"><a href="https://www.w3web.net/create-node-rest-api-to-insert-update-delete-from-soql/" target="_blank" rel="noopener noreferrer"> more →</a></span></p>
                </div>    
            </div>
        </template>

        <template if:true={visualforceValue}>
            <div class="tabContent">                        
                <div class="postImage">					
                    <a href="https://www.w3web.net/visualforce-page-to-return-data-from-multiple-custom-object/" target="_blank" rel="noopener noreferrer">
                        <img src="https://www.w3web.net/wp-content/uploads/2021/05/vfpMultipleObjects.png" width="300" height="200"></img>
                    </a>
                </div> 
                <div class="imgRt"> 
                <h3 class="slds-text-heading_small slds-text-color--error"><strong>Salesforce Visualforce Page</strong></h3> 
                <p class="titleTag"><b><a href="https://www.w3web.net/visualforce-page-to-return-data-from-multiple-custom-object/" target="_blank" rel="noopener noreferrer">How to fetch data from multiple different object in visualforce page.</a></b></p>
                <p>Create visualforce page to retrieve data from multiple custom objects using custom controller wrapper class.</p>                     
                <p>Today in this post we are going to learn about how to retrieve data from multiple custom objects using custom controller wrapper class and display data in a table of VF page in Salesforce..<span class="readMore"><a href="https://www.w3web.net/visualforce-page-to-return-data-from-multiple-custom-object/" target="_blank" rel="noopener noreferrer"> more →</a></span></p>
                </div>    
            </div>
        </template>

        <template if:true={triggerValue}>
            <div class="tabContent">                        
                <div class="postImage">					
                    <a href="https://www.w3web.net/trigger-to-check-duplicate-email-on-lead/" target="_blank" rel="noopener noreferrer">
                        <img src="https://www.w3web.net/wp-content/uploads/2021/07/duplicateEmailCheckLeadFeature.png" width="300" height="200"></img>
                    </a>
                </div> 
                <div class="imgRt"> 
                <p class="titleTag"><b><a href="https://www.w3web.net/trigger-to-check-duplicate-email-on-lead/" target="_blank" rel="noopener noreferrer">Preventing duplicate records of contact based on multiple fields.</a></b></p>
                <p>Write a trigger on lead to prevent duplicate records based on lead email Whenever the records is inserted Or updated using apex class.</p>                     
                <p>Today in this post we are going to learn about How to Check Duplicate Email on Lead Object in Salesforce. Write a trigger on lead to prevent duplicate records.<span class="readMore"><a href="https://www.w3web.net/trigger-to-check-duplicate-email-on-lead/" target="_blank" rel="noopener noreferrer"> more →</a></span></p>
                </div>    
            </div>
        </template>

        <template if:true={jqueryJavascriptValue}>
            <div class="tabContent">                        
                <div class="postImage">					
                    <a href="https://www.w3web.net/image-gallery-with-a-jorizontal-thumbnail-carousel/" target="_blank" rel="noopener noreferrer">
                        <img src="https://www.w3web.net/wp-content/uploads/2020/10/imageGallerySliderFeature.png" width="300" height="200"></img>
                    </a>
                </div> 
                <div class="imgRt"> 
                <h3 class="slds-text-heading_small slds-text-color--error"><strong>Salesforce Visualforce Page</strong></h3> 
                <p class="titleTag"><b><a href="https://www.w3web.net/image-gallery-with-a-jorizontal-thumbnail-carousel/" target="_blank" rel="noopener noreferrer">Create multiple image slider in jquery.</a></b></p>
                <p>Write a trigger on lead to prevent duplicate records based on lead email Whenever the records is inserted Or updated using apex class.</p>                     
                <p>Today in this post we are going to learn about Create a Custom Image Gallery With a Horizontal Thumbnail Carousel Simply using Custom JQuery Small Function and CSS for Create Image Gallery.<span class="readMore"><a href="https://www.w3web.net/image-gallery-with-a-jorizontal-thumbnail-carousel/" target="_blank" rel="noopener noreferrer"> more →</a></span></p>
                </div>    
            </div>
        </template>

        <template if:true={salesforceLwcValue}>
            <div class="tabContent">                        
                <div class="postImage">					
                    <a href="https://www.w3web.net/lwc-get-customize-custom-metadata-in-apex/" target="_blank" rel="noopener noreferrer">
                        <img src="https://www.w3web.net/wp-content/uploads/2021/09/lwcFetchCustomMetaDataFeature.png" width="300" height="200"></img>
                    </a>
                </div> 
                <div class="imgRt"> 
                <h3 class="slds-text-heading_small slds-text-color--error"><strong>Salesforce LWC</strong></h3> 
                <p class="titleTag"><b><a href="https://www.w3web.net/lwc-get-customize-custom-metadata-in-apex/" target="_blank" rel="noopener noreferrer">how to get custom Metadata in lwc using Apex</a></b></p>
                <p>How to fetch/customize the custom metadata and display the list of metadata in lightning component using Apex class in Salesforce Lightning Web Component — LWC.</p>                     
                <p>Today in this post we are going to learn about How to How to fetch/customize the custom metadata and display the list of metadata in lightning component using Apex class in Salesforce Lightning Web Component — LWC.<span class="readMore"><a href="https://www.w3web.net/lwc-get-customize-custom-metadata-in-apex/" target="_blank" rel="noopener noreferrer"> more →</a></span></p>
                </div>    
            </div>
        </template>
        

    </lightning-layout-item>
</lightning-layout>



`

Step 2:- Create Lightning Web Component : lwcVerticalNavigation.js

` import { LightningElement, track } from 'lwc';

export default class LwcVerticalNavigation extends LightningElement {

@track currentContent = 'tutorial';
@track tutorialValue = false;    
@track integrationValue = false;
@track visualforceValue = false;
@track triggerValue = false;
@track jqueryJavascriptValue = false;
@track salesforceLwcValue = false;


changeHandleAction(event) {
    const selected = event.detail.name;        

    this.currentContent = selected;

    if (selected == 'tutorial'){
        this.tutorialValue = true;
    }else{
        this.tutorialValue = false;
    }

    if (selected == 'integration'){
        this.integrationValue = true;
    }else{
        this.integrationValue = false;
    }

    if (selected == 'visualforce'){
        this.visualforceValue = true;
    }else{
        this.visualforceValue = false;
    }

    if (selected == 'trigger'){
        this.triggerValue = true;
    }else{
        this.triggerValue = false;
    }

    if (selected == 'jqueryJavascript'){
        this.jqueryJavascriptValue = true;
    }else{
        this.jqueryJavascriptValue = false;
    }

    if (selected == 'salesforceLwc'){
        this.salesforceLwcValue = true;
    }else{
        this.salesforceLwcValue = false;
    }

}

}`

Step 3:- Create Lightning Web Component : lwcVerticalNavigation.js-meta.xml

**

52.0
true

lightning__AppPage
lightning__RecordPage
lightning__HomePage

**

Step 4:- Create Lightning Web Component : lwcVerticalNavigation.css

.tabContent{display:block; padding:15px; font-size:14px; overflow: hidden; width: 70%;} .tabContent .postImage{display: inline-block; float:right; } .tabContent .postImage img{border:1px #ddd solid;} .readMore{font-size:14px; font-weight:bold; display:inline-block; padding:0 0 0 10px;} .readMore a{color:#ff0000; text-decoration:none;} .readMore a:hover{color:#04a5ca; text-decoration:underline;} .titleTag{font-size:18px;} .titleTag a{color:#003333; font-weight:bold;} .imgRt{width:52%; float:left;}

Step 5:- Create Lightning Application : lwcVerticalNavigationApp.app

<aura:application extends="force:slds"> <c:lwcVerticalNavigation/> </aura:application>

→ Get source code live demo link:-

@vijayk3327 vijayk3327 added documentation Improvements or additions to documentation question Further information is requested labels Jul 14, 2023
@vijayk3327 vijayk3327 self-assigned this Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
Status: No status
Development

No branches or pull requests

1 participant