Yes. You can do through using xml and simple javascript code. Please find below:
xml:
<panel>
<table id="tableid">
<title>Records</title>
<search>
<query>index="_internal" |eval Select=SourceType
| table Select,*
</query>
<earliest>-1d@d</earliest>
<latest>now</latest>
</search>
<option name="wrap">true</option>
<option name="rowNumbers">false</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="count">100</option>
<option name="link.openSearch.visible">true</option>
<option name="link.inspectSearch.visible">false</option>
</table>
</panel>
javascript:
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
var RangeMapIconRenderer = TableView.BaseCellRenderer.extend({
canRender: function(cell) {
// Only use the cell renderer for the Select field
return (cell.field === 'Select');
},
render: function($td, cell) {
if(cell.field === 'Select')
{
//console.log("cellData: ", cell);
var icon = cell.value;
//console.log("icon: ", icon);
$td.html('<label class="checkbox"><a href="#" data-name="splunk_web_service" class="btn"><i id="icon'+icon+'" class="icon-check" style="display: none;"></i></a></label>');
}
}
});
mvc.Components.get('tableid').getVisualization(function(tableView){
// Register custom cell renderer
tableView.table.addCellRenderer(new RangeMapIconRenderer());
// Force the table to re-render
tableView.table.render();
});
});
... View more