Backbone events for Linking/Unlinking a Record

Hi,

Is there a way in javascript to listen for a linking or unlinking of a record (ie in a sub-panel)?

In an extended Case RecordView, I've tried monitoring this.model.on('all', ...) and also this.model.getRelatedCollection('contacts_cases').on('all') but nothing seems to reliably fire when I link or unlink a contact.

I know I can do this in php via a logic hook, but I was hoping for a front-end solution.

Any tips or guidance greatly appreciated.

Thanks.

Gary.

Parents
  • All the code is in clients/base/fields/link-action/link-action.js (try jssource/src_files/clients/base/fields/link-action.js if it's minified) -  specifically the selectDrawerCallback function links the records using app.data.createRelatedBean, and has a callback to  this.context.get('collection').resetPagination(); and this.context.set('collapsed', false); to refresh the subpanel. Read the code there.

    You could extend link-action and override that event, or have a callback on createRelatedBean.

Reply
  • All the code is in clients/base/fields/link-action/link-action.js (try jssource/src_files/clients/base/fields/link-action.js if it's minified) -  specifically the selectDrawerCallback function links the records using app.data.createRelatedBean, and has a callback to  this.context.get('collection').resetPagination(); and this.context.set('collapsed', false); to refresh the subpanel. Read the code there.

    You could extend link-action and override that event, or have a callback on createRelatedBean.

Children