I replaced one of my input field for a custom lookup component. I can get the value of it and add it to a variable. The problem I have is I need to push it to an Array and I cannot get the name of the component as this is not a property like the Input-Field. See below HTML:
<td scope="col"> <!--COMPONENT--> <c-lwc-lookup object-api-name="product2" icon-name="standard:product" onrecordselection={changeHandler}> </c-lwc-lookup> </td> <td scope="col"> <!--InputField--> <lightning-input value={field.Description__c} data-index={index} access-key={index} type='text' name="fieldDescription" onchange={changeHandler}> </lightning-input> </td> My component is a lookup on the object Product2. and once I select the product, I am calling the changeHandler function where I need to get the accesskey and add the value to my Array. Unfortunately, it is not working like the Input Field... Here is my changeHandler
changeHandler(event){ var index = event.target.dataset.index; //This is the component part that is not working //event.target.name is not working because the component doesn't have that attribute if(event.target.name==='product2'){ //event.target.accessKey is not working neither but I can add it to the component but still not working this.contentArray[event.target.accessKey].Name = event.detail.selectedValue; } //This is the Input-Field and works as a charm. else if(event.target.name==='fieldDescription'){ this.contentArray[event.target.accessKey].Description = event.target.value; } } If I had only one line it will work by just using a variable but I have multiple lines... Thanks!