mojito
mojito copied to clipboard
refreshView on a composite mojito binder will lead to all child mojit binders stop working
Found a problem with refreshView...
I tried running refreshView on a composite mojit, and I found if the child mojits have binders, the whole javascript will stop working after refreshview. The last message I saw was "Did not find DOM" and "client status: paused" And then all the tunnel call stopped working.
My workaround is either
- don't call refreshView on a composite mojit
- if you have a composite mojit, making sure your child mojits dont have binders.
but I'd like to see this problem being fixed at mojito.
I have found that defining an onRefreshView method in your binder allows you to re-attach your event listeners.
onRefreshView: function (node) {
this.bind(node);
},
See the use of refreshView in:
http://developer.yahoo.com/cocktails/mojito/docs/intro/mojito_binders.html#binder-examples
I am afraid we are talking about different issues; I know the onRefreshView function. This bug is talking about calling refreshView on a composite mojit will cause the whole JS stopped working, not the bind() function
Sorry, I had just discovered that method myself so I got excited and replied too soon.
I am also facing the same issue. And it's been open for 2 years !!! Thanks @taomin for the workaround.