Hi I am referring below table for example, I want add CSS for both values in Office column in the table.
Name
Position
Office
Age
Airi Satou
Accountant
Tokyo
33
Angelica Ramos
Chief Executive Officer
London
47
Ashton Cox
Junior Technical Author
San Francisco
66
Bradley Greer
Software Engineer
London
41
Brenden Wagner
Software Engineer
San Francisco
28
Brielle Williamson
Integration Specialist
New York
61
Bruno Nash
Software Engineer
London
38
Caesar Vance
Pre-Sales Support
New York
21
Cara Stevens
Sales Assistant
New York
46
Cedric Kelly
Senior Javascript Developer
Edinburgh
22
I want highlight both values Tokyo and San Francisco. I have added script it will work but problem is its will work one value only. It will highlight San Francisco only. I have add script as follows
require(
[
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
],
function (_, $, mvc, TableView) {
function cssLoad(tableName, field_name, field_val) {
var CustomLinkRender = TableView.BaseCellRenderer.extend({
canRender: function (cell) {
return _([field_name]).contains(cell.field);
},
render: function ($td, cell) {
var cell_value = cell.value;
if (cell.field == field_name) {
if (cell_value == field_val.trim()) {
$td.css('color', '#1717E6');
$td.css('font-weight', 'bold');
$td.css('text-decoration', 'underline');
$td.css('text-decoration-color', 'blue');
}
}
$td.text(cell_value).addClass('string');
}
});
var selectedTable = mvc.Components.get(tableName);
if (typeof (selectedTable) != "undefined") {
selectedTable.getVisualization(function (tableView) {
tableView.addCellRenderer(new CustomLinkRender());
tableView.render();
});
}
}
//Single table Hardcode call
cssLoad('table1', 'Position', 'Software Engineer');
cssLoad('table1', 'Age', '66');
cssLoad('table1', 'Office', 'Tokyo');
cssLoad('table1', 'Office', 'New York')
});
Please Help me!. For highlight multiple values.
... View more