Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ({
- /**
- * Purpose:Limiting the subpanel records based on parent module
- * Here we are limiting contacts module records based on parent module(Opporunities,Accounts and other module) *
- * Path : sugar/custom/modules/contacts/clients/base/views/subpanel-list/subpanel-list.js
- * Written by: Ajay Kumar
- * Dated: 31 May 2016
- */
- extendsFrom:'RecordlistView',
- fallbackFieldTemplate: 'list',
- plugins: ['ErrorDecoration', 'Editable', 'SugarLogic', 'Pagination', 'LinkedModel', 'ResizableColumns'],
- contextEvents: {
- "list:editall:fire": "toggleEdit",
- "list:editrow:fire": "editClicked",
- "list:unlinkrow:fire": "warnUnlink"
- },
- initialize:function(options){
- this._super("initialize", [options]);
- var parentModule=this.context.parent.get('model').module;
- var subModule=this.context.get('model').module;
- var collectionOptions = this.context.has('collectionOptions') ? this.context.get('collectionOptions') : {};
- //limiting 20 contacts for parent module opportunities
- if((_.isEqual(parentModule,'Opportunities')) && (_.isEqual(subModule,'Contacts'))){
- this.context.set('collectionOptions', _.extend(collectionOptions, {
- limit: 20
- }));
- }
- else if((_.isEqual(parentModule,'Accounts')) && (_.isEqual(subModule,'Contacts'))){
- //limiting 3 contacts for parent module Accounts
- this.context.set('collectionOptions', _.extend(collectionOptions, {
- limit: 3
- }));
- }
- else{
- //Sugar default
- this.context.set('collectionOptions', _.extend(collectionOptions, {
- limit: app.config.maxSubpanelResult
- }));
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement