Skip to content

Instantly share code, notes, and snippets.

@maranemil
Created April 16, 2015 03:17
Show Gist options
  • Save maranemil/606dfccd61f4e49cdb3a to your computer and use it in GitHub Desktop.
Save maranemil/606dfccd61f4e49cdb3a to your computer and use it in GitHub Desktop.
SugarCRM7 Add Colors in Views
// http://laurenthinoul.com/how-to-add-a-record-color-to-a-listview-in-sugarcrm/
({
extendsFrom: 'RecordlistView',
initialize: function (options) {
app.view.invokeParent(this, {type: 'view', name: 'recordlist', method: 'initialize', args: [options]});
this.collection.on('data:sync:complete', function () {
this.renderColors();
}, this);
},
renderColors: function () {
_.each(this.fields, function (field) {
if(field.$el.find('div[data-original-title="Inactive"]').length > 0){
field.$el.parents('tr').css("background-color", "#FFBABA");
field.$el.parents('tr').children('td').css("background-color", "transparent");
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment