Oh no, I'm sorry - I was going to point out something that needed a change, but then I realized I already made that mistake in what I posted. I corrected it in my post, but here's a corrected version as well:
[...require and all that...]
var compare_value; // This is done outside of the CustomRangeRenderer definition
var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
canRender : function (cell) {
// Enable this custom cell renderer for both the availability and the response field
return _(['reference', 'check']).contains(cell.field);
},
render : function ($td, cell) {
// Add a class to the cell based on the returned value
var value = parseFloat(cell.value);
if (cell.field === 'check') {
compare_value = value;
}
// Apply interpretation for response
if (cell.field === 'reference') {
if (value > compare_value) { //actual comparison is here
$td.addClass('range-cell').addClass('range-severe');
...
}
...
... View more