How to make the flow panel updates when changes happened to custom component

Hi,

I am trying to make an app with a custom component that has a button (that removes the component from the flow panel), text box and label, and then add this component to flow panel based on the changes on a drop-down menu in the main page, see the app:
https://anvil.works/build#clone:BV7CE6ZIGIFU6EJI=T5XC4KUSH7RRFOCOVVT266LN


The problem is: when I remove the component (after clicking on the button); the space that was equipped by the component stays (it look like the panel doesn’t update with the custom component button click)

Any help is appropriated
Thank you

I just had a quick look.

In your link callback, could you try using:

def link_remove_click(self, **event_args):
  self.remove_from_parent()

Instead of:

def link_remove_click(self, **event_args):
  self.clear()
1 Like

It removes the link only and the component stays.

You wanted to get rid of the spaces, correct?

before (using self.clear)

com-video-to-gif%20(10)

After (using self.remove_from_parent):

com-video-to-gif%20(11)

Again, I just had a quick look (and can look closer in a little bit), but self.remove_from_parent() removes Form3 from the flow panel in Form2.

Apologies if I have misunderstood, but could you describe what behaviour you were hoping for?

2 Likes

Please can you post a clone link for the app after you have applied @alcampopiano’s suggestion?

I just tried it and it worked perfectly for me, unless we are both misunderstanding you.

3 Likes

Sorry, I tried it in a wrong place, it’s working now. Thank you :blush:

3 Likes