0

I am implementing deletion of contacts from a data table in lightning. Used checkboxes to select/unselect the contacts.Created Delete Contact button at the header level.

Now I want to display the delete contact button depending on whether the checkbox is selected or not as a SEPERATE COMPONENT which is in other panel component but not on the header.If checkbox is not selected then the Delete contact button as a seperate component should not be displayed. I mean to say instead of a button here can we create a panel component to display the Delete contact button component depending on the checkbox selected or not instead of displaying it on the header every time.

Can you let me know how to do this and how to communicate between the components when doing this?

1 Answer 1

3

One way of doing this I see is using APPLICATION event communication between button panel and table component.

Panel component will have button whose "disabled" attribute is handled by boolean attribute. Let's say <lightning:button disabled="{!v.record_selected}">

Now, once the record is selected on table component fire an event sending true or false based on whether there is at-least one selected records or not. Try not to fire the same event on next selection or records. On the other side button panel component will handle that event and toggle the boolean attribute which will handle the button enable/disable.

Hope this will work.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .