Voegt een kleur toe aan een record in de SugarCRM ListView. als je dat bv bij accounts wil toepassen, moet de code tegevoegd worden aan: custom/modules/Accounts/clients/base/views/recordlist/recordlist.js.
In dit voorbeeld zoeken we naar de waarde 'Incative'. Als je een andere waarde wilt, moet de 'data-original-title' aangepast worden.
({
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");
}
});
}
});