There is a 'View' in the model with the event click
. After using the Quicksand effects plug-in for jQuery, the objects loose their event handlers. I have tried to add the listener for the event with standard methods in backbone.js:
events: {
"click .objContact" : "openChat"
}
and the same tools jQuery delegate
:
var self=this;
this.$el.delegate('.objContact','click', function(){
self.openChat();
});
and live
:
var self=this;
this.$el.find('.objContact').live('click', function(){
self.openChat();
});
but the click
event disappears.
What could be the problem? And how do I solve it?
UPD: Calling 'Quicksand' is in Backbone.Router (subject to change is obtained directly by means of jQuery, not Backbone), so changes are not handled in Backbone.View
UPD 2: The problem is solved in the following way - by moving the handling of the click
event from the View-model to View-collection. And treated with live (did not work in on
)
Do a call to delegateEvents()
after the related DOM entries have changed or become overwritten. In a traditional Backbone app this is typically done in the render
method, but you probably need for figure out when and where quicksand does it's magic (I do not know anything about it), and call delegateEvents
that will reactivate the events for the current elements in the DOM.