Advertisement
Guest User

Untitled

a guest
May 31st, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. ({
  2. /**
  3. * Purpose:Limiting the subpanel records based on parent module
  4. * Here we are limiting contacts module records based on parent module(Opporunities,Accounts and other module) *
  5. * Path : sugar/custom/modules/contacts/clients/base/views/subpanel-list/subpanel-list.js
  6. * Written by: Ajay Kumar
  7. * Dated: 31 May 2016
  8. */
  9. extendsFrom:'RecordlistView',
  10. fallbackFieldTemplate: 'list',
  11. plugins: ['ErrorDecoration', 'Editable', 'SugarLogic', 'Pagination', 'LinkedModel', 'ResizableColumns'],
  12. contextEvents: {
  13. "list:editall:fire": "toggleEdit",
  14. "list:editrow:fire": "editClicked",
  15. "list:unlinkrow:fire": "warnUnlink"
  16. },
  17. initialize:function(options){
  18. this._super("initialize", [options]);
  19. var parentModule=this.context.parent.get('model').module;
  20. var subModule=this.context.get('model').module;
  21. var collectionOptions = this.context.has('collectionOptions') ? this.context.get('collectionOptions') : {};
  22. //limiting 20 contacts for parent module opportunities
  23. if((_.isEqual(parentModule,'Opportunities')) && (_.isEqual(subModule,'Contacts'))){
  24. this.context.set('collectionOptions', _.extend(collectionOptions, {
  25. limit: 20
  26. }));
  27. }
  28. else if((_.isEqual(parentModule,'Accounts')) && (_.isEqual(subModule,'Contacts'))){
  29. //limiting 3 contacts for parent module Accounts
  30. this.context.set('collectionOptions', _.extend(collectionOptions, {
  31. limit: 3
  32. }));
  33. }
  34. else{
  35. //Sugar default
  36. this.context.set('collectionOptions', _.extend(collectionOptions, {
  37. limit: app.config.maxSubpanelResult
  38. }));
  39. }
  40. }
  41. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement