Created
April 13, 2017 02:29
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/* 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