mojito icon indicating copy to clipboard operation
mojito copied to clipboard

refreshView on a composite mojito binder will lead to all child mojit binders stop working

Open taomin opened this issue 12 years ago • 5 comments

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

  1. don't call refreshView on a composite mojit
  2. 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.

taomin avatar Apr 11 '12 21:04 taomin

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);
},

Satyam avatar May 12 '12 10:05 Satyam

See the use of refreshView in:

http://developer.yahoo.com/cocktails/mojito/docs/intro/mojito_binders.html#binder-examples

Satyam avatar May 12 '12 11:05 Satyam

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

taomin avatar May 15 '12 08:05 taomin

Sorry, I had just discovered that method myself so I got excited and replied too soon.

Satyam avatar May 15 '12 15:05 Satyam

I am also facing the same issue. And it's been open for 2 years !!! Thanks @taomin for the workaround.

jithine avatar Dec 30 '13 23:12 jithine