Skip to content

Instantly share code, notes, and snippets.

@jbest84
Created June 13, 2014 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbest84/998294d67a430f8d2f91 to your computer and use it in GitHub Desktop.
Save jbest84/998294d67a430f8d2f91 to your computer and use it in GitHub Desktop.
BigDeal\UI\GroupListConfigurationProvider
/*globals define */
define([
'dojo/_base/declare',
'dojo/_base/array',
'dojo/dom-construct',
'Sage/UI/GroupListConfigurationProvider'
],
function (
declare,
array,
domConstruct,
GroupListConfigurationProvider
) {
var groupListConfigProvider = declare('BigDeal.UI.GroupListConfigurationProvider', [GroupListConfigurationProvider], {
_createConfigurationForList: function (entry) {
var layout, listConfig, structure, layoutItems;
// Get the list configuration from the base class
listConfig = this.inherited(arguments);
// Array of structure items the base class has built up
structure = listConfig.structure[0].cells[0];
// Layout array from our feed entry (SData)
layout = entry.layout;
array.map(structure, function (structureItem) {
if (structureItem.property === 'Sub-Type') {
// Add a formatter function to this column
structureItem.formatter = function (val) {
var node, color;
if (val === 'Type A') {
color = 'Green';
} else {
color = 'Salmon';
}
if (!val) {
val = '(empty)';
color = "Gray";
}
var node = domConstruct.create('span', { 'style': 'font-size: 16px; color: ' + color, 'innerHTML': val });
return node.outerHTML;
};
}
return structureItem;
});
return listConfig;
}
});
return groupListConfigProvider;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment