Alert when record count changes in subpanel

I have a module "A", which is related to Module "B" and Module "C".

When items are added/removed from Module "C" they sometimes add/delete records to/from module "B" via logic hook.

I want to alert the user whenever an item is added/removed from "B".

I don't particularly want to deal with every way "C" could add to "B" (link, unlink, create from subpanel top... etc).

Is there a way I capture a change in the subpanel count and alert then?

Or perhaps a better solution than that?

Thanks,

FrancescaS

Parents
  • You need to implement a listener in the view:

    initialize: function(options) {
       this._super('initialize', [options]);
       app.events.on('app:sync:complete', this._bootstrap, this);
    },

    _bootstrap: function() {
       this.delay = 5 * 1000;

       window.setTimeout(_.bind(this.startPulling, this), 1000);

       return this;
    },

    The method "startPulling" may fetch the current set of records for a given subpanel. Eventually you can store in a class' attribute the old number of records and, once that number changes, you may display the alert.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • You need to implement a listener in the view:

    initialize: function(options) {
       this._super('initialize', [options]);
       app.events.on('app:sync:complete', this._bootstrap, this);
    },

    _bootstrap: function() {
       this.delay = 5 * 1000;

       window.setTimeout(_.bind(this.startPulling, this), 1000);

       return this;
    },

    The method "startPulling" may fetch the current set of records for a given subpanel. Eventually you can store in a class' attribute the old number of records and, once that number changes, you may display the alert.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children