0

Accordingly to the documentation, the special aura change handler can be used to detect when a value in one of the component's attributes changes.

Everything is fine with attributes of type Boolean, String, Integer, etc. The problem arises with lists. The event fires only when I add or delete an element of the list but doesn't fire when I change the values of one of them.

This makes sense. However I'm wondering if it is possible to make the event fire even for a change of elements in a list.

1

If you want to do this, you need a component that represents the child and you need to have the change handlers for its presentation to generate an event. You then have the parent component manage the child components and have a handler that handles the events from the children as needed. Take a look at the documentation for more advice.

| improve this answer | |
  • Right now I have a list of child components create through an aura:iteration on the list whose change should fire the value event through the aura:handler. I know that I could fire an event from one of the children components and handle it in the parent component. However, I don't know how to store/retrieve the previous value of the changed element. – gvgramazio Jun 3 '19 at 8:12
  • Can you not use details from the child component's change event, forwarding these to the parent in your custom event? – Phil W Jun 3 '19 at 8:15
  • Do you mean using a change value handler in the child on the single element that was shared by parent and forwarding its old and current value through a custom event registered by the child and handled by the parent? – gvgramazio Jun 3 '19 at 8:19
  • 1
    Yes, basically. – Phil W Jun 3 '19 at 8:32

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.