function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bharath Kumar ThotaBharath Kumar Thota 

Refresh a particular div in lightning component

Hi,
I have a Lightning component form which consists of many fields and parts. What I need is to refresh a particular part of the Lightning component without refreshing the whole component.
User-added image
In the above image I have the Fetch Contact Info in one whole div so when I click the refresh icon it should empty all the fields if the values are present. Is there any possibility to do that, any information will be helpful.

Thanks,
Bharath Kumar Thota
Best Answer chosen by Bharath Kumar Thota
Abhishek BansalAbhishek Bansal
Hi Bharath,

If the fields are related to a single object then you can simply initialize the object again like this:
Object con = new Object();

IN this way all the fieds will be set to null.

Thanks,
Abhishek Bansal.

All Answers

Abhishek BansalAbhishek Bansal
Hi Bharath,

Onclick of this image you can call a contoller method and in this method you can set the values to null. In this way it will be refreshed.
Let me know if you need any more information on this.

Thanks,
Abhishek Bansal.
Bharath Kumar ThotaBharath Kumar Thota
Hi Abhishek,
Thanks for the reply. Yeah I too got that thought but if we have more fields for example 20 fields we have to make 20 fields as null right. Instead of that don't we have any other way like taking the div part and making the fields in that div to empty so that we do not need to make all the 20 fields as null. Please can you suggest me if you have any idea for doing in this way.

Thank you,
Bharath Kumar Thota
Abhishek BansalAbhishek Bansal
Hi Bharath,

If the fields are related to a single object then you can simply initialize the object again like this:
Object con = new Object();

IN this way all the fieds will be set to null.

Thanks,
Abhishek Bansal.
This was selected as the best answer