javascript - Backbone Drop Event Listener Amongst Two Views -
my app has dashboard 2 panels. each panel different backbone view renders out template within respective panel. views instantiated backbone router. need put drop event listener somewhere detect when <li>
element 1 view has been dropped onto second view. but, don't know put listener...
• i can't event fire when put event in either of views "drop #drop-zone": "handledrop"
• putting event listener in router after views instantiated doesn't work either.
• my next thought put drop event listener inside listener dragstart, i'm not sure if best route go.
where appropriate place listen drop event?
// app.js, main.js, router.js, etc. window.event_bus = {}; _.extend(object, backbone.events); event_bus.on("drop", function(target) { // target }); // drop-zone-one-view.js "drop #drop-zone-one": function () { event_bus.trigger('drop', 'drop-zone-one') } // drop-zone-two-view.js "drop #drop-zone-two": function () { event_bus.trigger('drop', 'drop-zone-two') }
Comments
Post a Comment