Created
April 9, 2016 07:15
-
-
Save AjayKumar01/91cef1aea4f2da80c70632eb7e7dda3c to your computer and use it in GitHub Desktop.
Disabling edit button and un link button action based on parent module field value.
This file contains hidden or 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
({ | |
/* Disabling edit button and un link button action based on parent module field value. | |
* Ajay Kumar | |
* Path: sugar/custom/modules/Leads/clients/base/views/subpanel-list/subpanel-list.js | |
*/ | |
extendsFrom: 'SubpanelListView', | |
initialize: function(options) { | |
this._super('initialize', [options]); | |
this.on('render', this._disableActions, this); | |
}, | |
_disableActions: function() { | |
var industryValue = this.context.parent.get('model').get("industry"); | |
var parentModule = this.context.parent.get('module'); | |
if (!_.isEqual(industryValue, 'Construction') && _.isEqual(parentModule, "Accounts")) { | |
_.each(this.meta.rowactions.actions, function(action) { | |
if (!_.isEqual(action['icon'], "fa-eye")) { // for preview button | |
delete action['event']; | |
action['css_class'] = 'disabled btn'; | |
} | |
}); | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment