Jump to content

My textarea visual returns blank without data after refreshing data table using RefreshAsync in IronPython.


lew hooyye

Recommended Posts

I would like to refresh a data table called Numberof carsafter clicking on the refresh button and the button will stop spinning and the textarea visualis rendered after the data is refreshed.

This is my IronPython code on my refresh action control button.

 

from Spotfire.Dxp.Data import DataTable

from System.Collections.Generic import List, Dictionary

from Spotfire.Dxp.Framework.ApplicationModel import NotificationService

from Spotfire.Dxp.Application.Visuals import HtmlTextArea

 

//notification service

notify = Application.GetService[NotificationService]();

 

//Tables(s) to refresh - change/add more if required

tbls = List[DataTable]()

tbls.Add(Document.Data.Tables['Number of cars'])

 

//After tables are refreshed, update html

def afterLoad(exception, Document=Document, notify=notify):

if not exception:

 

# Stop Spinner

newHtml = vis.As[HtmlTextArea]().HtmlContent

oldDiv = ''

newDiv = ''

newHtml = newHtml.Replace(oldDiv,newDiv)

 

# Apply change

vis.As[HtmlTextArea]().HtmlContent = newHtml;

vis.As[HtmlTextArea]().HtmlContent += " " # Force re-render

 

 

else:

notify.AddErrorNotification("Error refreshing table(s)","Error details",str(exception))

 

//Refresh WAN table

Document.Data.Tables.RefreshAsync(tbls, afterLoad)

 

 

This is my HTML and JS code.

 

--spinning animation--

.spinner{

animation-name: spin;

animation-duration: 2000ms;

animation-iteration-count: 20;

animation-timing-function: linear;

}

 

@keyframes spin {

from {

transform:rotate(0deg);

}

to {

transform:rotate(720deg);

}

}

 

 

 

 

autorenew

 

 

 

 

 

function refreshdt(){

$("#refreshbtn").addClass("spinner");

$("#ace2b4675676565acf423ad6756431cd").click();

 

}

 

 

 

What I am looking for:

 

 

 

What it returns after refresh:

Link to comment
Share on other sites

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