Advertisement
vamsiampolu

Trigger code

Dec 8th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //View that has the data triggers an event on the View that does not
  2. showEditView:function(){
  3.     //Trigger callbacks for the given event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callbacks.
  4.     app.EditView.trigger('edit',this.model);
  5.   }
  6.  
  7.  
  8. //View that has desperate need of the data
  9. initialize:function initializeEditView(){
  10.     console.log("Initializing Modal for editing");
  11.     this.on('edit',function(model){
  12.       //handle the event here...
  13.       this.model=model;
  14.       console.log(this.model.toJSON());
  15.       this.$form=this.$el.find("form");
  16.       this.initializeEditForm();
  17.       this.showYourself();
  18.     });
  19.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement