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
Jugbeer BholaJugbeer Bhola 

Refresh values of lightning component inside a lightning component

Hoping someone has insight.  There is a lightning component embedded inside a lightning component.  The component has been given and aura:id of 'buildingLU'   The component also has a couple of user defined attributes of 'buildingId' and 'buildingName.'  This lookup value needs to have the ability to easily be cleared out.  The onchange event of a checkbox fires an event called 'clearbuildingName'  That routine should clear the component values.  Having trouble setting the 'v.value' of the user defined attributes. Either that needs to happen or the component needs to somehow be rerendered.  That will appear like the field is cleared.  I have included the markup of the component and the javascript controller code.   Thank You.

If I use       component.find('buildingLU').set("v.buildingName" , "")         the value is cleared but the user interface still contains the text. 
 
<div class="slds-form-element">
    <div class="slds-form-element__control">
        <span class="slds-form-element__label" for="buildingLookup">building Name</span>
        <c:buildingLookupCmp aura:id="buildingLU" buildingId="{!v.Customer.buildingId__c}" buildingName="{!v.Customer.buildingId__r.Name}" />
    </div>
    <div class="slds-float_right">
        <label class="slds-checkbox">
        <span class="slds-form-element__label" for="clearbuilding">Clear building</span>
         <input id="clearbuilding" type="checkbox" onchange="{!c.clearbuildingName}" /> 
         <span class="slds-checkbox--faux"></span>
        </label>
    </div>
    <div>
    </div>
</div>
clearbuildingName : function(component, event, helper) {       	
        component.find('buildingLU').set("v.value" , "");	
        var Customer = component.get("v.Customer");
        Customer['buildingId__c'] = "";
        Customer['buildingNumber'] = "";
        Customer['buildingId__r.Name'] = "";
        component.set("v.Customer", JSON.parse(JSON.stringify(Customer)));       
    },



 
Best Answer chosen by Jugbeer Bhola
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi,

May I request you to please refer the below link for reference.
https://developer.salesforce.com/forums/?id=906F0000000MNgIIAW

Hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar