Jump to content
  • How to - Show a "loading..." prompt when reloading external data


    This Article provides useful Spotfire Tips & Tricks

    Article created by SDG Group

    Supported Version: Spotfire 7.0 or later

    A guide on how to get a refresh indicator which looks something like the below, note however that we cannot trap the "Viz redrawn" event as part of this hence the slight delay after the bar vanishing and the table updating:

    reloader.thumb.gif.44bc62a8514c1c961fb9fcca812534b4.gif


    Approach

    • Add a progress indicator inside a div; hidden by default
    • Use a html button which calls JS to show the progress indicator, and then triggers python by forcing a click event on a second spotfire button
    • The Iron Python uses a special RefreshAsync method introduced in Spotfire 7 to manipulate html after tables have refreshed
    • Use a known workaround to force the html to redraw (force a new whitespace at the end)

    Attached you'll find a zip containing all the files needed to get started:

    1. Sample html
    2. Javascript layer
    3. Iron Python layer
    4. An optional SQL script which fabricates a table taking two seconds to load (can be set up using an MSSQL connection); this is purely for testing purposes.

    Instructions

    Each file contains comments to walk you through setting this up, however the full instructions are as follows:

    1. Extract the contents of the zip file.
    2. Create a text area if you don't have one on the page yet.
    3. Go into Document > Properties, and create a new Iron Python script
      1. Change YOUR_TABLE_NAME to the relevant table (and add more if required)
      2. Add a script parameter with name=vis and type=visualization
    4. On your text area, "Edit html" and:
      1. copy and paste the contents of Reloader.html into it
      2. Insert a spotfire action button where prompted to do so inside the html and trigger the python script, passing in the text area as the script parameter

        capture_140.png.696a859bfa6f2846a685878ecdcbdf53.png
      3. (Optional) Change the <Style> section to contain your own spinner, of which many can be found here
      4. Add a new Javascript file, and copy the contents of Reloader.js into it.
      5. Save and close the Spotfire html editor

    Don't forget that you can use any refresh indicator you want inside the provided "loading" div!


    We hope you find this page useful. Do you have a challenge we could help with? Get in touch!

    SDG Group in Spotfire Partner Locator: https://www.spotfire.com/partners/partner-locator


    Attachments

    You can download attachments from resources.

    reloader.zip

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...