How to make a name changing toggling button

I have a toggle button which switches between "Active " and "Inactive".(see the attached image)

I want to make it as a button which changes its name like in attached animation gif. file.(When I click on it it should change its name and execute the script)
here is my script

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

#For boolean data type
if Document.Properties["XBarRuleFourStatus"] == "Active":
    Document.Properties["XBarRuleFourStatus"] = "Inactive"
else:
    Document.Properties["XBarRuleFourStatus"] = "Active"

 

for the "name changing toggle button" , the sample script is like this(I found this on spotfireDeveloper

html
<div id='spotfireButton' style='display:none'>
 <SpotfireControl id="y0ursp07f1r3c0n7r01IdH3r3" />
</div>

<SPAN id=startButton>Start</SPAN>
<SPAN id=stopButton style='display:none'>Stop</SPAN>

 

python
#changes RangeFilter low and high bounds in small increments
from Spotfire.Dxp.Application.Filters import RangeFilter, ValueRange
from Spotfire.Dxp.Data import IndexSet

 

#get a reference to the range filter in question
filt=Document.FilteringSchemes[0].Item[myDataTable].Item[myDataTable.Columns.Item["b"]].As[RangeFilter]()

delta = .1
if(filt.ValueRange.High.ToString() == "High"): #reset filters
idx = IndexSet(myDataTable.RowCount,True)
min = myDataTable.Columns["b"].RowValues.GetMinValue(idx).Value
filt.ValueRange = ValueRange(min,min+delta)
print filt.ValueRange
else:
  filt.StepBodyUp()

javascript
var pid
var speed = .5 //change filter 2/second
start = function(){
pid = setInterval(function(){
   $("#spotfireButton input").click()
},speed*1000)
$('#stopButton').show()
$('#startButton').hide()
}

stop = function(){
clearInterval(pid)
   $('#dd').text("stopped " + pid)
$('#stopButton').hide()
$('#startButton').show()
}

$("#stopButton").button().on('click',stop)

$("#startButton").button().on('click',start)

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
I would be really grateful if you can help me.

 

Thanks!

 

Attachments

AttachmentSize
Image icon toggle_button.png10.87 KB
Image icon animation4_stream.gif3.23 MB

(1) Answer

Login