Spotfire - 如何添加重新加载按钮 [英] Spotfire - How to add a reload button

查看:79
本文介绍了Spotfire - 如何添加重新加载按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何添加按钮以及每当用户点击按钮时数据都会重新加载.

How to add a button and whenever user clicks on the button the data reloads.

此外,用户应该知道数据何时刷新.

Also the user should know when the data gets refreshed.

推荐答案

你可以使用这个 python 脚本,如发现 此处.

You could use this python script, as found here.

from System.Collections.Generic import List, Dictionary 
from Spotfire.Dxp.Data import DataTable 
from System.Collections import ArrayList

#Refreshing a single Data table:
dataTable.Refresh() // where dataTable is a script parameter of type DataTable

#Refreshing multiple tables:
#Note that more than one table can be added to the List object.
tables = ArrayList()
tables.Add(Document.Data.Tables["DataTable1"]) 
tables.Add(Document.Data.Tables["DataTable2"]) 
Document.Data.Tables.Refresh(tables)
#As such DataTableCollection.Refresh Method refreshes the given tables in dependency order.
#OR
Document.Data.Tables.RefreshAsync(tables)
#And DataTableCollection.RefreshAsync Method (IEnumerable< DataTable> ) refreshes the given tables in dependency order. 
#Tables that have asynchronous refresh (i.e. Data On Demand and Data Functions) and tables that depend on them will be refreshed 
#in later transactions.

# Another possible option:

Tbls = List[DataTable]() 
Tbls.Add(Document.Data.Tables["DataTable1"]) 
Tbls.Add(Document.Data.Tables["DataTable2"]) 
for i in Tbls:
 Document.Data.Tables.Refresh([i])

为了让用户知道数据何时刷新,只需设置一个具有当前日期/时间的文档属性,并在文本区域中显示该文档属性.当上面的脚本运行时,日期/时间将更新.

In order to let the user know when the data was refreshed, just set a document property with the current date/time and surface that document property in a text area. When the script above is run, the date/time will update.

此外,请查看位于 此处(适用于 7.6,但也可以找到较新的 7.12 API).虽然它的组织方式有点令人沮丧,但您可以了解可以在脚本中调用的方法和类,以便以编程方式执行各种操作.

Also, have a look at their Python API page located here (for 7.6, but the newer 7.12 API can be found as well). While it is organized in a slightly frustrating way, you can get a feel for methods and classes you can call in your script to do all sorts of things programmatically.

这篇关于Spotfire - 如何添加重新加载按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆