Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Refresh data without using automation services

This script starts or stop a timer that triggers a Spotfire Action Control.  In this case, the spotfire control refreshes an underlying data table.



html

<style>
.light{
  position:absolute;
  top:50px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: lightgray;
  cursor:pointer;
}

.on{
  background-color: #ABFF00;
  box-shadow: 
    rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, 
    inset #304701 0 -1px 9px,
    #89FF00 0 2px 14px;
}
</style>

<span id=debug xxxstyle='display:none'>--</span>
<span class="light" id='lightButton'></span>
<span id='reloadButton' style='display:none'>
   <SpotfireControl id="36d875690f344e45b9ef764058a3ed32" />
</span>

js
var pid
var speed = 300//click the spotfire button every 5 mins 

start = function(){
 pid = setInterval(function(){
    $("#reloadButton input").click()

$('#lightButton').hasClass("on")?
$('#lightButton').removeClass("on"):
$('#lightButton').addClass("on")

 },speed*1000)
 $('#lightButton').addClass("on")
 $("#reloadButton input").click()
 $("#lightButton").attr('onclick',"stop()")
 $('#debug').text("process "+started+" started ")
}

stop = function(){
 clearInterval(pid)
 $('#debug').text("process "+started+" stopped ")
 $('#lightButton').removeClass("on")
 $("#lightButton").attr('onclick',"start()")
}

$("#lightButton").attr('onclick',"start()")



script
#dt is a data table script parameter
#refreshes the data
dt.Refresh()






No comments: