Activity Feed
- Posted Re: How can I display hidden fields in a tooltip? on Dashboards & Visualizations. 12-13-2018 05:53 AM
- Posted How can I display hidden fields in a tooltip? on Dashboards & Visualizations. 12-07-2018 06:11 AM
- Tagged How can I display hidden fields in a tooltip? on Dashboards & Visualizations. 12-07-2018 06:11 AM
Topics I've Started
Subject | Karma | Author | Latest Post |
---|---|---|---|
0 |
12-13-2018
05:53 AM
Thanks for the answer, that's what I went with. Even though it feels like a cheap trick, it seems to be the only way to do it !
... View more
12-07-2018
06:11 AM
Hi,
I'd like to display a tooltip when someone hover the values of the first column of my table. This tooltip would display values taken from 3 hidden fields.
My table looks like that :
<table id="tblTooltip">
<search base="fullKpi">
<query>
table reference,referenceOrder,validation_status
</query>
<preview>
<set token="refOrder">$result.referenceOrder$</set>
</preview>
</search>
<fields>reference,validation_status</fields>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
and my JS looks like that:
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
var CustomTooltipRenderer = TableView.BaseCellRenderer.extend({
canRender: function(cell) {
return cell.field === 'Reference';
},
render: function($td, cell) {
var defaultTokenModel=mvc.Components.get("default");
var tokenValue = defaultTokenmodel.get("refOrder");
var message = cell.value;
var tip = tokenValue;
$td.html(_.template('<a href="#" data-toggle="tooltip" data-placement="left" title="<%- tip%>"><%- message%></a>', {
tip: tip,
message: message
}));
// This line wires up the Bootstrap tooltip to the cell markup
$td.children('[data-toggle="tooltip"]').tooltip();
}
});
mvc.Components.get('tblTooltip').getVisualization(function(tableView) {
// Register custom cell renderer
tableView.table.addCellRenderer(new CustomTooltipRenderer());
// Force the table to re-render
tableView.table.render();
});
});
I'm trying to display the value of the field referenceOrder when hovering the reference field, however it displays "$result.referenceOrder$ in plain text
I saw another response (https://answers.splunk.com/answers/495575/how-to-show-a-hidden-field-in-a-tooltip-when-i-hov.html) with a workaround by combining hidden fields into a visible field and then splitting the values inside it, but I'd like to know if there's a way to do it properly ? Another token use or something maybe ?
Any idea is welcome ! 😄
... View more
- Tags:
- splunk-enterprise