Skip to content

Dynamic form wrapping an accordion with remove buttons #613

Answered by akshayka
MaWeffm asked this question in Q&A
Discussion options

You must be logged in to vote

But clicking a button removes always the last element in the samples, not the respective one with the same 'id'.
2) how does it work to remove the correct element from the state containing the sample objects?

This is due to the fact that closures in Python are late-binding. All your on_click lambdas bind i to the last element in your iterable. Here are some references that explain more and show solutions:

  1. How can I add a remove button to each of the elements in the accordion

I think you can do this by batching…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MaWeffm
Comment options

Answer selected by MaWeffm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants