I have a Pill Container, which contains items from the Contact sObject. When I click the x button nothing happens.


<lightning:pillContainer items="{!v.selectedContactList}" onitemremove="handleRemovePill"/>

My Contact List is dynamically selected, so it could be changed anytime.

I also tried to build the container and the items in a loop

    <aura:iteration var="pillLabel" items="{!v.selectedContactList}">
        <span class="slds-pill">{!pillLabel.Name}
            <button onclick="{!c.handleRemovePill}" class="slds-button slds-button--icon slds-pill__remove" title="Remove">
                <lightning:icon iconName="utility:close" size="x-small" class="slds-input__icon" alternativeText="Remove" />

When I click the x button it reacts, but I don't know how to get the actual record.

  • 3
    Looks like you're calling the action method in the wrong way. You missed the {!c.}. You should try: <lightning:pillContainer items="{!v.selectedContactList}" onitemremove="{!c.handleRemovePill}"/>. Also, we can't help you if you don't post the controller method. – Martin Lezer Jan 3 '19 at 10:38
  • Thanks! that was the problem! how couldn’t I notice this! – Mo Hamada Jan 3 '19 at 10:45
  • 1
    You're welcome ! It happened to all of us at least once! – Martin Lezer Jan 3 '19 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.