Created
April 16, 2015 03:17
-
-
Save maranemil/606dfccd61f4e49cdb3a to your computer and use it in GitHub Desktop.
SugarCRM7 Add Colors in Views
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
// 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