Category Archives: Javascript & HTML

Style cross table and data table with Javascript

With this small Javascript trick you can style a cross table and a data table, once activated it overrides the default style sheet. You can change the background color, font color or the font style and size. This works in the client and the webplayer.

css_data_table css_cross_table

1. Create a TextArea and edit it as HTML.
2. Add the following javascript.

Note: the page your report opens first should contain this Javascript.

 

Include video in your analysis

This is a little javascript trick to add video in your analysis…but this only works in the webplayer.

html5_video

The javascript will inject the HTML5 video tag into your TextArea and will only be visible in the webplayer. Depending on the browser versions you need to add different versions of the video (see the two sources in the example below).

  1. Create a TextArea and edit it as HTML.
  2. Add the following content:
    It should look like this
    video_html
  3. Create a Javascript and add the following code:

Reminder: the video will only work in the webplayer.

Automatically start an IronPython script

Every time a user will navigate to this page an IronPyton script will be executed.
The trick is to add a drop-down list property and use some Javascript to trigger the change event of the drop-down list.

  1. Create a drop-down list property.
    open_dl
    1. Add a drop-down list property.
    2. Set a script for the property.
    3. Add some fake data, atleast 2 rows.
  2. Next add a Javascript to the HTML/text area.
    load_el
    4. Copy the ID of the spotfire element (you need this in the javascript).
    5. Add a new javascript and use the copied ID.
    6. Use the following javascript to do the trick:

Clickable HTML element (or Label property)

  1. Create a html element (or use a Label property), just make sure you know the ID of the element.
  2. Add the following Javascript: