Created
June 13, 2014 17:04
-
-
Save jbest84/998294d67a430f8d2f91 to your computer and use it in GitHub Desktop.
BigDeal\UI\GroupListConfigurationProvider
This file contains 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
/*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