Last active
October 3, 2016 20:32
-
-
Save AjayKumar01/78c461f9fc3c58fff3731b5afa78156f to your computer and use it in GitHub Desktop.
Adding button in list view
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
({ | |
extendsFrom:'RecordlistView', | |
initialize:function(options){ | |
this._super('initialize',[options]); | |
this.context.on('list:updatecurrentsize:fire',this.mass_update_currentsize,this); | |
}, | |
/** | |
* Function to mass update the current size | |
* for all selected accounts | |
* Written by: Ajay Kumar | |
* Dated: 7th Dec 2015 | |
*/ | |
mass_update_currentsize:function(){ | |
//loading label | |
app.alert.show('updating-inprogress', {level: 'process', title: app.lang.get('LBL_PRO_ENABLE')}); | |
var self=this; | |
var massCollection = this.context.get("mass_collection"); | |
var id_array = []; | |
massCollection.each(function(data){ | |
id_array.push(data.id); | |
}); | |
//call api to update current size of selected mandates | |
app.api.call('create', app.api.buildURL('Accounts/updateCurrentSize'),{man_id_array:id_array},{ | |
success: function(data){ | |
//dismiss progress label | |
app.alert.dismiss('updating-inprogress'); | |
//if successful | |
if(data.status) { | |
app.alert.show('update-success', { | |
level: 'success', | |
messages: app.lang.get('TPL_MASSUPDATE_SUCCESS', self.module, { num: data.records }), | |
autoClose: true, | |
autoCloseDelay: 5000 | |
}); | |
//if error | |
} else { | |
app.alert.show('update-failure', { | |
level: 'error', | |
messages: app.lang.get('ERR_MOBILE_FILE_READ'), | |
autoClose: true, | |
autoCloseDelay: 5000 | |
}); | |
} | |
//refresh the list | |
app.router.refresh(); | |
}, | |
}); | |
} | |
}) |
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
<?php | |
if(!defined('sugarEntry'))define('sugarEntry',true); | |
$viewdefs['Accounts']['base']['view']['recordlist'] = array( | |
'favorite' => true, | |
'following' => true, | |
'sticky_resizable_columns' => true, | |
'selection' => array( | |
'type' => 'multi', | |
'actions' => array( | |
array( | |
'name' => 'edit_button', | |
'type' => 'button', | |
'label' => 'LBL_MASS_UPDATE', | |
'primary' => true, | |
'events' => array( | |
'click' => 'list:massupdate:fire', | |
), | |
'acl_action' => 'massupdate', | |
), | |
array( | |
'name' => 'calc_field_button', | |
'type' => 'button', | |
'label' => 'LBL_UPDATE_CALC_FIELDS', | |
'events' => array( | |
'click' => 'list:updatecalcfields:fire', | |
), | |
'acl_action' => 'massupdate', | |
), | |
array( | |
'name' => 'merge_button', | |
'type' => 'button', | |
'label' => 'LBL_MERGE', | |
'primary' => true, | |
'events' => array( | |
'click' => 'list:mergeduplicates:fire', | |
), | |
'acl_action' => 'edit', | |
), | |
array( | |
'name' => 'delete_button', | |
'type' => 'button', | |
'label' => 'LBL_DELETE', | |
'acl_action' => 'delete', | |
'primary' => true, | |
'events' => array( | |
'click' => 'list:massdelete:fire', | |
), | |
), | |
array( | |
'name' => 'export_button', | |
'type' => 'button', | |
'label' => 'LBL_EXPORT', | |
'acl_action' => 'export', | |
'primary' => true, | |
'events' => array( | |
'click' => 'list:massexport:fire', | |
), | |
), | |
array( | |
'name' => 'update_currentsize_button', | |
'type' => 'button', | |
'label' => 'LBL_UPDATE_CURRENT_SIZE', | |
'events' => array( | |
'click' => 'list:updatecurrentsize:fire', | |
), | |
'acl_action' => 'export', | |
), | |
), | |
), | |
'rowactions' => array( | |
'actions' => array( | |
array( | |
'type' => 'rowaction', | |
'css_class' => 'btn', | |
'tooltip' => 'LBL_PREVIEW', | |
'event' => 'list:preview:fire', | |
'icon' => 'fa-eye', | |
'acl_action' => 'view', | |
), | |
array( | |
'type' => 'rowaction', | |
'name' => 'edit_button', | |
'label' => 'LBL_EDIT_BUTTON', | |
'event' => 'list:editrow:fire', | |
'acl_action' => 'edit', | |
), | |
array( | |
'type' => 'follow', | |
'name' => 'follow_button', | |
'event' => 'list:follow:fire', | |
'acl_action' => 'view', | |
), | |
array( | |
'type' => 'rowaction', | |
'name' => 'delete_button', | |
'event' => 'list:deleterow:fire', | |
'label' => 'LBL_DELETE_BUTTON', | |
'acl_action' => 'delete', | |
), | |
), | |
), | |
'last_state' => array( | |
'id' => 'record-list', | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment