Skip to content

Instantly share code, notes, and snippets.

@elchele
Created April 13, 2017 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elchele/9c2f1d0f1a61e3c2e5e0dc7c9dcca8c6 to your computer and use it in GitHub Desktop.
Save elchele/9c2f1d0f1a61e3c2e5e0dc7c9dcca8c6 to your computer and use it in GitHub Desktop.
Refresh of a peer subpanel upon a change occurring in a different subpanel. Ex: Add record on Notes subpanel for Accounts => refresh Leads subpanel.
({
/* File: ./custom/modules/Notes/clients/base/views/create/create.js */
extendsFrom: 'CreateView',
save: function(){
this._super('save');
//TODO: Add logic to check if parent model exists to verify if being created via subpanel or other means.
var parentModel = this.context.parent.get('model');
var ctx = this.context;
var lead = app.data.createBean('Leads', {first_name: "Angel", last_name: "Magana", account_id: parentModel.get('id')});
lead.save(null, {
success: _.bind(function(){
ctx.parent.trigger('subpanel:reload', {links: ['leads']});
}, this)
});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment