Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Dynamically making elements using #update, with elements containing their own actions #71

Open
choptastic opened this issue Dec 2, 2013 · 0 comments

Comments

@choptastic
Copy link
Member

This is merely a report for myself (or someone else who might feel up to fixing this one), but when dynamically creating elements using an attached #update action with the specified elements themselves containing wired actions. The wired actions will not work.

Example:

#button{id=button, text="Click me first", click=[
   #update{type=insert_after, target=button, elements=[
      #button{text="Click me next", click=#alert{text="You clicked the new button"}}
   ]}
]}.

In this, after clicking "Click me first", the "Click me next" button will be created, but clicking it will do nothing.

The problem is caused by the fact that in order to add the new elements, they need to be rendered by nitrogen, and in doing so, the attached actions get wired immediately. To fix this, the attached actions need to only be wired when the first button is clicked, with everything being enclosed in a closure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant