Skip to main content

#LWC Development4 人がディスカッション中

#LWC #LWC Development #Apex What practical projects can help learners understand LWC lifecycle hooks, component communication, Lightning Data Service, wire adapters, and event handling, and how should they connect LWC components with Apex methods?

2 件の回答
  1. 10月17日 4:23

    Hi @Sai Kumar Good question! The best way to learn LWC and Apex integration is to build small projects and gradually move to real-world scenarios.

    1. Recommended Practical Projects

    1. Account Search: Fetch Account records using Apex and @wire.
    2. Contact Management: Create, update, and delete Contacts using Lightning Data Service.
    3. Student Management: Practice parent-child communication using @api and custom events.
    4. Opportunity Dashboard: Display Opportunity data using Apex and refresh it after updates.

    2. Important Concepts to Practice

    • Lifecycle Hooks: connectedCallback() and renderedCallback().
    • Component Communication: @api and custom events.
    • Wire Adapters: Fetch Salesforce data using @wire.
    • Apex Integration: Use @AuraEnabled methods for server-side operations.
    • Error Handling: Handle exceptions and display meaningful messages.

    3. Official Salesforce Resources

    Start with an Account Search component, then build a complete Student Management application using LWC and Apex.

    Key Point: Don't just copy code from Trailhead. Practice writing code, debugging errors, and understanding how LWC communicates with Apex.

    Hope this helps!

    Venkat Yadav | SFDCINDIA

0/9000
0/9000

Seeking LWC Developer + Accessibility Specialist 

I have a client in need of a Salesforce Accessibility Specialist with STRONG Apex and LWC developer skills and experience creating managed packages for third parties. If you have these skills, please reach out to me ASAP. Thank you! 

 

#Job Postings  #LWC Development  #Accessibility

0/9000

Visual representation of parent to child communication and vice-versa using Lightning Web Component in Salesforce.

 

Parent to child communication using public property and method.

 

Child to parent communication using custom events.

 

Find the source code here: https://lnkd.in/evxBdrbR 

 

Visual representation of parent to child communication and vice-versa using Lightning Web Component in Salesforce. Parent to child communication using public property and method.

Capture 2.PNG

 

Capture 3.PNG

 

Capture 4.PNG

 

#LWC  #LWC Development  #LWC Components  #Salesforce Developer  #Salesforce

0/9000
Karthik J (jk) が「#LWC Component」で質問

Hi all

I have written LWC that adds a new row whenever I click on the plus button but the newly added row inherits the value from the previous row. I want to set the values for the newly created rows as optional. Can anyone please help me here?

 

New Row inherits the value of previous row

 

#LWC Component  #LWC Development  #LWC

3 件の回答
  1. 2025年8月12日 16:07

    Hii,

    If you want to ensure that newly added rows do not inherit values from the previous row, you should make sure that the data structure you use to hold the rows is initialized with completely new values each time(ideally blank here).

    You can use row add approach something like this 

0/9000

Hi Guys,

Can you please suggest how can we print pdf from lwc component?

I tried window.print() which gives whole page, we only want contents from our lwc component. 

 

#LWC Development

#Download Pdf

6 件の回答
  1. 2024年7月17日 12:38

    Hello community! 

    I had similar task and was able to complete it using just lwc! 

     

    For that I had to create the following js method:

     

    handlePrintClick () {

    let printableElement = this.template.querySelector('.print-section');

    if (printableElement) {

    let clone = printableElement.cloneNode(true);

    let printWindow = window.open('', '_blank');

    if (printWindow) {

    printWindow.document.body.appendChild(clone);

    let style = printWindow.document.createElement('style');

    style.textContent = `

    @page {

    size: auto; /* auto is the initial value */

    margin: 0mm; /* this affects the margin in the printer settings */

    }

    @media print {

    body {

    margin: 0;

    padding: 0;

    }

    .no-print {

    display: none;

    }

    }

    `;

    printWindow.document.head.appendChild(style);

    printWindow.focus();

    printWindow.print();

    printWindow.close();

    } else {

    console.error('Failed to open print window');

    }

    } else {

    console.error('Printable element not found');

    }

    }

    and you need to update the content of html with css class to the place which you wanted to print (I had lots of inner data, parent and childs)

     

    <div class="print-section">

    Data which should be printed

    </div>

    Note: In my case I had all css values in the same html file (not a separate css, I used style tag) 

0/9000

How to build a Dynamic Multi-Select Picklist field in LWC ? 

 

Multi-select picklists are commonly used in applications where users need to choose multiple options from a list of predefined values. Implementing this functionality using LWC allows developers to create powerful and customizable components within the Salesforce platform. 

 

Follow this article to go through implementation details 

 

https://sfdcpulse.wordpress.com/2024/02/27/lightning-web-component-dynamic-custom-multiselect-picklist/

 

 

#Salesforce Developer  #LWC  #Lightning Web Components  #LWC Development

1 件のコメント
0/9000

Hi All,

I want to learn the LWC in Salesforce.

Could anyone please provide the roadmap that I need to follow.

If possible could please share the resources as well

Thanks in advance 😇

#Salesforce Developer #LWC #LWC Component #LWC Development #LWC Components
11 件の回答
  1. 2024年10月25日 9:57

    I can share you my udemy credentials..

    you can learn lwc from there as well or from the resources above provided

0/9000

Hi,

I am trying to reload the previous page after saving an edit form. After clicking on Save, I have used  window.history.back(); but it only navigates to the previous page, I require it to reload as well. Is there a way to do this?

#LWC  #LWC Component #Custom LWC #LWC Development #LWC Components

4 件の回答
  1. 2024年12月10日 7:23

    Hii,

    To navigate back and reload the previous page, the most straightforward solution is to use window.history.back() followed by a short delay and window.location.reload().

     

    The implementation may look something like this : 

    window.history.back();

    setTimeout(function() {

    window.location.reload();

    }, 500);

0/9000

//I have created checkboxes using checkgroup the checkboxes are in single line iam trying to align in two columns but iam not succeded.  

<lightning-checkbox-group name="Checkbox Group" label="Checkbox Group" options={options}                         value={value} onchange={handleChange}></lightning-checkbox-group>                     <p>Selected Values are: {selectedValues}</p>

 

Thanks for any Help

 

#Trailhead #LWC #LWC Development #LWC Component #Lightning #Lightning Web Components

2 件の回答
  1. 2024年11月18日 15:01

    To display checkboxes in two columns using lightning-checkbox-group, you'll need to adjust the layout using CSS because lightning-checkbox-group doesn't natively support multi-column layouts out of the box.

     

    You can achieve the two-column layout by wrapping the checkboxes in a custom div container and using CSS Grid or Flexbox to display the checkboxes in two columns.

     

    You can use something like this : 

    /* Styling for the checkbox container to use grid */

    .checkbox-container {

     display: grid; /* Use grid layout */

     grid-template-columns: repeat(2, 1fr); /* Create two equal columns */

     gap: 16px; /* Add space between checkboxes */

     max-width: 600px; /* Optional: set a max width */

    }

     

    /* Ensure the checkbox options fit well inside each column */

    .lightning-checkbox-group .slds-checkbox_faux {

     margin-bottom: 8px; /* Adjust the spacing between checkboxes */

    }

0/9000