You need to sign in to do that
Don't have an account?
Aryama Ivaturi
Hello Below is my code,
I need to pass the index value from aura iteration to custom lwc component so that I can set it uniquely . Currently for lightning input I have aura:id as customlookup. But I need to have it dynamically set so the value from custom lookup lwc is assigned to lightning input.
Below is my controller function for customlookup
Need help me on this.
How to pass data from Aura Component to LWC
Hello Below is my code,
<aura:iteration items="{!v.dssList}" var="dss" indexVar="index"> <tr> <td> {!index + 1} </td> <td> <c:lwcCustomLookUp objectName="Service__c" fieldName="Name" selectRecordId="{!v.selectRecordId}" selectRecordName="{!v.selectRecordName}" iconName = "action:new_account" onselected="{!c.selectedRecords}"/> <lightning:input aura:id="customlookup" name="service" type="text" label="Service" value="{!dss.Service__c}" class="slds-hidden" /> </td> <td> <lightning:input name="isdatastored" type="checkbox" label="Is Data Stored" value="{!dss.Is_Data_Stored__c}" /> </td> <td> <lightning:input name="isdataprocessed" type="checkbox" label="Is Data Processed" value="{!dss.Is_Data_Processed__c}" /> </td> <td> <lightning:input name="isdatatransmitted" type="checkbox" label="Is Data Transmitted" value="{!dss.Is_Data_Transmitted__c}" /> </td> <td> <a onclick="{!c.removeRowDSS}" data-record="{!index}"> <lightning:icon iconName="utility:delete" size="small" alternativeText="Delete"/> <span class="slds-assistive-text">Delete</span> </a> </td> </tr> </aura:iteration>
I need to pass the index value from aura iteration to custom lwc component so that I can set it uniquely . Currently for lightning input I have aura:id as customlookup. But I need to have it dynamically set so the value from custom lookup lwc is assigned to lightning input.
Below is my controller function for customlookup
selectedRecords : function(component, event, helper) { var selectRecName = event.getParam('selectName'); var selectRecId = event.getParam('currentRecId'); if(selectRecName != undefined) { component.set("v.selectRecordName", selectRecName); component.set("v.selectRecordId", selectRecId); alert(component); // var a = event.getSource(); //var id = a.getLocalId(); //alert(id); //component.find("").set("v.value", selectRecId); component.find("customlookup").set("v.value", selectRecId); }
Need help me on this.
It appears that we have to specify the lightning web component inside the aura component to pass any data to LWC
Here is an example: https://salesforcediaries.com/2019/09/15/pass-value-to-lwc-from-parent-aura-component/
Anudeep
Plz try this: