Jump to content

Is there a way to trigger a javascript function via ironPython


Manoj Chaurasia

Recommended Posts

  • 1 year later...

Figured that by adding a small change to the html, Spotfire will refresh the page! Attached this IronPython script on a document property when the value changes:

//make sure your vis is a script parameter that points to your Text Area visualization

from Spotfire.Dxp.Application.Visuals import HtmlTextArea

vis.As[HtmlTextArea]().HtmlContent += " "

Link to comment
Share on other sites

  • 4 months later...
  • 4 weeks later...

To be more specific for the community members asking how exactly this was accomplished, I will provide some details on the way that I believe it can be accomplished, but I haven't tested yet. I'm not thrilled with the implementation though and would love to see a better way. It would be simple if onchange events were fired when changing a document property via python.

In the same text are asa buttonwith an IronPython scriptyou can do the following:

1) Right-Click text area and choose "Edit HTML". Add javascript to the same text area with the below function, which will run anytime the page loads:

$(document).ready(function(){

// Hide thelabel so the user neversees it. Of course you could justhardcode visibility directly in the HTML.

document.getElementById("ID From Step 3").style.visibility='hidden'

// Write whatever javascript you need

});

2) As part of the script for the button you will need tore-render the HTML. I need to test, but I believe this will cause the 'ready' event to fire. You can reference the answer posted by LucadF herefor an example of re-rendering the HTML. I will update this post once I test it myself.

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...