Reputation: 1455
I have a backbone view set up like so:
MyView = Backbone.View.extend({
events: {
'click' : 'clickOnitHandler',
'stop' : 'dropHandler'
},
// Rest of class
What I would like to do here is hook a jquery-ui event for the draggable control.
This would usually be done like so (with jquery):
$( "#draggable" ).draggable({
start: function() {
// stuff
},
});
So this would go in the render() method of the backbone view, which doesn't seem quite right. I would prefer it to be declared in the events array for the view.
But not sure how to make it accessible here.
Upvotes: 1
Views: 630
Reputation: 1455
I fixed this. Simply like this.
MyView = Backbone.View.extend({
events: {
'click' : 'clickOnitHandler',
'dragstop' : 'dropHandler',
},
Upvotes: 1