I have a html designed textarea (along the lines of a KPI tile) with a spotfire contol in place (the KPI value). Right now, the functionality is that when the spotfire control is clicked, the visualizations on the template change based on a ironpython script.
I want to extend this functionality so that by clicking on anywhere on the html KPI tile, the contol click is triggered.
I am able to capture the click event on the HTML element, but when i trigger a click event on the SF element, the desired action is not being triggered.
Eg:
$(".kpivalue").click(function(){
this.children("SpotfireControl").trigger("click");
});
<DIV class=kpivalue><SpotfireControl id="1234567890xxx" /></DIV>
I answered a bit too quickly earlier. oops!
controls are not rendered as elements; these are placeholders or tokens that get replaced with HTML when rendered.
in the case of a Caluclated Value, the generated DOM looks like:
<div id="myContainerDiv">
<span id="randomGUID1" style>
<span id="randomGUID2" viewid="randomGUID2" class="EmbeddedMiniatureVisualization" ...>
<span class="actionCell" style="...">theCalculatedValueValue</span>
</span>
</span>
</div>
thus, when you want to target the actual Calculated Value, you'd need something like
$("#myContainerDiv").click(function(){
$(this).children("actionCell").trigger("click");
});
since Spotfire's DOM can be a little weird, you have to be a little weird yourself :) my understanding is that .trigger("click") will trigger a click on a JQuery element, but not the actual DOM. for that you'll need something like:
$(".kpivalue").click(function(){
this.children("SpotfireControl")[0].click();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With