1

I created a reusable lightning component that will act as a related list component. I want to handle add/remove event when the user makes changes from Edit Page (Settings-> Edit Page).

Example: I place my component under the Account's related tab

(Account's children: Opportunity, Custom Object1, Custom Object2, Custom Object3).

I added the Custom Lighting component 4 times for Opportunity, Custom Object1, Custom Object2, Custom Object3 when the user removes Custom Object1 from Edit Page, I want to handle an event that the user removed the custom lightning component which is a tie with Custom Object1.

Please let me know if you have any idea or suggestion.

  • Not sure, weather it will work or not, You can try using change event for the string type attribute. – sanket kumar May 30 at 13:03
  • How are you setting the object type on each instance of the custom lightning component. How are you seeing that the first Lightning Component is for Opportunity, the second for Custom Object1 etc. – Ayoola Olapo May 30 at 13:48
  • @sanketkumar change event will not work because of its fire when an attribute value change happens, Thanks for your input. FYI: I'm thinking to try with destroy event. – Jaymin Suthar May 30 at 13:51
  • @AyoolaOlapo yet I'm not able to find a way to store order but if I get my question's answer then I will know the order. To keep which object have how many custom related lightning component, I'm maintaining a custom config object. – Jaymin Suthar May 30 at 13:58
1

I got my question answer using destroy handler and able to handle it.

Code:

<aura:handler name="destroy" value="{!this}" action="{!c.handleDestroy}"/>

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.