hi VsplunkV,
for my problem to color a specific value within multivalued field, i overwrite the html content in source code by javascript implement.
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
], function (_, $, mvc, TableView) {
var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
canRender: function (cell) {
// Enable this custom cell renderer for both the active_hist_searches and the active_realtime_searches field
return _(['fieldName1', 'fieldName2']).contains(cell.field);
},
render: function ($td, cell) {
if (cell.field === 'fieldName1') {
var valueDx = String(cell.value)
var html_content = "";
var tokens = [];
var separators = ['\\,'];
tokens = valueDx.split(new RegExp(separators.join('|'), 'g'));
for (var i = 0; i < tokens.length; i++) {
var numbers = parseFloat(tokens[i].split(":")[1]);
if (numbers == 7888) {
html_content = html_content + "<div tabindex=\"0\" class=\"multivalue-subcell\" style=\"color:#E80C0C;\" data-mv-index=\"" + i + "\">" + tokens[i] + "</div>";
} else {
html_content = html_content + "<div tabindex=\"0\" class=\"multivalue-subcell\" data-mv-index=\"" + i + "\">" + tokens[i] + "</div>";
}
}
$td.html(html_content).addClass('string');
}
}
});
mvc.Components.get("tableName").getVisualization(function (tableView) {
// Add custom cell renderer, the table will re-render automatically.
tableView.addCellRenderer(new CustomRangeRenderer());
});
});
... View more