'after:save' listener

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • murray99
    Member
    • Jan 2017
    • 57

    'after:save' listener

    I'm trying to trigger some client code after a record has been saved. To do this I have tried to listen for the 'after:save' event like this:

    Code:
    define('studibase:after-save-handler', [], function() {
    var Handler = function(view) {
    this.view = view;
    };
    _.extend(Handler.prototype, {
    
    process: function() {
    this.listenTo(this.view, 'after:render', function() {
    
    alert('render!');
    
    this.listenTo(this.view, 'after:save', function() {
    
    alert('save!');
    
    
    }, this);
    
    
    }, this);
    },
    
    });
    _.extend(Handler.prototype, Backbone.Events);
    
    return Handler;
    });
    'after:render' triggers by 'after:save' does not. I'd rather add a listener than override and existing action.

    What am I doing wrong?
Working...