Hi all
I'm stuck. How do I change the table_icons_inline.js so that it uses the values "OK" and "Error" from a Column called "Status"? I want to have a green check when the Status is OK in a row... and of course red x or something similar when I get "Error" for Status in the row.
The only feedback I get is a blank report where it says " Search is waiting for input... ".
I thought this would work, but I have to admit I am somewhat new to javascript:
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
var CustomIconRenderer = TableView.BaseCellRenderer.extend({
canRender: function(cell) {
return cell.field === 'Status';
},
render: function($td, cell) {
var count = cell.value;
// Compute the icon base on the field value
var icon;
if(count == "Error") {
icon = 'alert-circle';
} else if(count == "-") {
icon = 'alert';
} else {
icon = 'check';
}
// Create the icon element and add it to the table cell
$td.addClass('icon-inline numeric').html(_.template('<%- text %> <i class="icon-<%-icon%>"></i>', {
icon: icon,
text: cell.value
}));
}
});
mvc.Components.get('table1').getVisualization(function(tableView){
// Register custom cell renderer
tableView.table.addCellRenderer(new CustomIconRenderer());
// Force the table to re-render
tableView.table.render();
});
})
That Javascript looks pretty correct, If the table isn't loading, it means that the search isn't being returned with Data. What search are you using to populate the table? If you perform the search in the search bar, does it return results over the same time range?
Are you using an HTML Dashboard? Simple XML? How are you setting the search manager to the table?