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
ShrutiiShrutii 

How to reset picklist values back to default in a lightning component

I am having modal pop up in account page, in that modal I have 1 picklist. We select 1 value from picklist and click on proceed button, based on the value selected from picklist a record type opens. But the issue is, again if I open the modal pop up same picklist value is selected by default until I reload the page. Can anyone please help me and suggest a solution so that If I click on proceed button, either the component refresh or picklist value should again reset to default "--NONE--".

Note : I tried  $A.get('e.force:refreshView').fire(); this, but this is not working and setting value of the picklist to --NONE-- using component.set is the setting it to --NONE-- but then no other value is displayed when I click on picklist. 

 
Team NubesEliteTeam NubesElite
The possible solution can be:

1.Implement resettable lightning interface
<aura:interface description="Interface template"> <aura:attribute name="toReset" type="boolean" default="false" description=""/> </aura:interface>
2.Extends this interface
<aura:component extensible="true" implements="c:resetable">
3. Implement value change handler to reset values
<aura:handler name="change" value="{!v.toReset}" action="{!c.onReset}"/>
Whenever you change value of toReset attribute, related c.onReset handler executes to repopulate/reset other attributes and as result this will trigger component rerendering similar to initial state/view.


Thank You
www.nubeselite.com

Developement | Training | Consulting

Please mark this as solution if your problem resolved.
ShrutiiShrutii
Hi,
I could not get, what should be there in onReset controller ?
Could you please elaborate.