Jump to content

How to pass value from ironpython to javascript in text area


Nithin Jacob

Recommended Posts

Hi,

In my dashboard I want to know whether the user is using the spotfire analyst version or the web version.

I am able to get it using this code in ironpython

applicationType =Application.GetType().ToString()

Now what I need is, to pass this value to javascript so that I can hide some features from web users

Thanks in advance

Link to comment
Share on other sites

Hi there,

 

You can do this if you have a TextArea on your page. So to do this follow these steps:

 

 

Create a document property to hold the result ofApplication.GetType().ToString() . In this example I call my property: "myNewProperty"

Assign this in your ironpython script e.g. Document.Properties["myNewProperty"] =Application.GetType().ToString()

Add a calculated value into a TextArea and set the value (by right clicking on it) to just be the document property value:"${myNewProperty}"

Then wrap theSpotfire html tag in an HTML tag such as a div, and give it a unique ID:

You can then reference the value inside this tag using Javascript using:$('#my-application-type').text().trim()

Once you have it working, add a style of style="display: none" to your div tag so it is hidden from your users. I find it is useful to show the value initially just to check it is working correctly.

 

There is a guide on this here also:

https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-45505_ga=2.61478511.235987687.1560159550-1712820799.1560159550&_gac=1.245615024.1560251077.EAIaIQobChMI7MiHl6Th4gIVZrftCh28BgsIEAAYASAAEgJBefD_BwE

 

Hope this makes sense, and gives you what you need.

 

Thanks

Colin

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...