Manoj Chaurasia Posted June 6, 2014 Share Posted June 6, 2014 Is there a way to trigger a javascript function via ironPython something like: from System.Windows.Browser.HtmlPage import Documentimport System.Windows.Browser.HtmlPage as HtmlPage HtmlPage.Window.Invoke("myJavascriptFunction", "hello world") Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted October 23, 2015 Author Share Posted October 23, 2015 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 More sharing options...
Ben Schalley Posted October 23, 2015 Share Posted October 23, 2015 Can you explain more How does the javascript function get called What imports need to be added Link to comment Share on other sites More sharing options...
Luca de Falco 4 Posted October 23, 2015 Share Posted October 23, 2015 This script add a space to text area.It's like a refresh,so the Javascript function is triggered Link to comment Share on other sites More sharing options...
lital zilber Posted March 22, 2016 Share Posted March 22, 2016 Hi, It doesn't trigger my JS code do you know another way Link to comment Share on other sites More sharing options...
Jeff Jug Posted April 19, 2016 Share Posted April 19, 2016 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 More sharing options...
Tom Tang 2 Posted October 22, 2019 Share Posted October 22, 2019 will there be an issue if adding a space to text area every time text area refreshs, will there be a stack overflow for vis.As[HtmlTextArea]().HtmlContent Link to comment Share on other sites More sharing options...
Suraj Ullas 2 Posted October 22, 2019 Share Posted October 22, 2019 I have never ran into to such an issue where there was a stack overflow for vis.As[HtmlTextArea]().HtmlContent Link to comment Share on other sites More sharing options...
Tom Tang 2 Posted October 23, 2019 Share Posted October 23, 2019 @surajullas great! if there are no issues after using enough long/frequent, it would consider a good workarround. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now