-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Closing a view then showing it does not re-bind triggers! #622
Comments
The work around for me was to call delegateEvents() on the view before I call .show() when I want to redisplay the view in the layout's region. Is this the expected behavior? Or should I submit a pull request with delegateEvents() being called on the view when .show() is called in a layout region? You would think close() and show() would automatically unbind and bind events respectively. |
Yeh same thing for me... had to do something like...
onClose it |
Looks like this is a DUP. #724 Looks like there are multiple issues open for this. |
The way think about marionette's views, is that they are disposable, which means you have to recreate them if you need them back; for those cases you want to keep your data somewhere so you can create a new instance an put it back on the view |
Recreating a new view and filling it in with old data is rather noticeable work. Here the issue resolved just with a single boolean flag: http://barc.github.io/backbone.giraffe/menuExample.html |
Yup look at #724 |
Let's say you have a layout view and show the following view for some random region. Everything works as expected, and when you call close() on the region with this view all the event bindings are removed as expected.
Here's the problem. If you call close() on the region, then show() with the same instance of the view, the triggers no longer work! The view still re-renders and displays as expected however.
You would assume that if onRender is called on the re-render that the @on event binding call would still work.
Apologies the following snippet is in Coffeescript, but results in the same issue.
The text was updated successfully, but these errors were encountered: