【问题标题】:Implementing Javascript in Spotfire在 Spotfire 中实现 Javascript
【发布时间】:2017-04-28 14:21:08
【问题描述】:

我有一个包含两个值(“START”和“END”)的下拉列表。此下拉值的条件,我想显示特定的 DIV 或其他。

我尝试实现以下代码,但它不起作用。当我更改下拉输入中的值时,什么也没有发生。

下拉 ID 为:5e64c4918c4b473a8ed1c55264aca3d9。

HTML 代码:

<P align=left><FONT size=2>Choice : <SpotfireControl id="5e64c4918c4b473a8ed1c55264aca3d9" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<DIV id="div1"><FONT size=2>List 1 :&nbsp;</FONT>&nbsp;<SpotfireControl id="5f252f7f373d48debc33bfde6fd7dd65" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV id="div2"><FONT size=2>List 2 :</FONT> <SpotfireControl id="136584e6f10143c9ade2a82f5cf4fef0" /></DIV>
<P>
<P align=left>&nbsp;</P>
<P align=left>&nbsp;</P>
<P align=left>&nbsp;</P>
<P><SpotfireControl id="42a0fbc386184501903389b4c48155a5" /></P>        

我的 Javascript 代码如下:

//Triggering the script if Drop Down selection is varied
$("#5e64c4918c4b473a8ed1c55264aca3d9").change(function()
{
var value = $("#5e64c4918c4b473a8ed1c55264aca3d9").val();  //To capture the index
var vt = $("#5e64c4918c4b473a8ed1c55264aca3d9").text(); //To Capture the  selected text
if(vt== "START")   //If the Drop Down selected value is Start
{
    $("#div1").show(); //Making the Input list visible 
    $("#div2").hide();
}
else
{
    $("#div1").hide(); //Making the Input list element hidden
    $("#div2").show();
}
}
);

我还创建了一个 Iron python 脚本,并将其链接到我的下拉列表:

Ironpython 脚本:

from Spotfire.Dxp.Application.Visuals import HtmlTextArea
ta.As[HtmlTextArea]().HtmlContent += " "

其中 ta 是“可视化”类型的输入。

你能帮帮我吗?

提前致谢

【问题讨论】:

    标签: javascript jquery python html spotfire


    【解决方案1】:

    由于不支持 on.click,我已经删除了 on.click 语句并且它正在工作!

    //Triggering the script if Drop Down selection is varied
    var value = $("#5e64c4918c4b473a8ed1c55264aca3d9").val();  //To capture the index
    var vt = $("#5e64c4918c4b473a8ed1c55264aca3d9").text(); //To Capture the  selected text
    if(vt== "START")   //If the Drop Down selected value is Enable
    {
      $("#div1").show(); //Making the Input Box visible 
      $("#div2").hide();
    }else{
      $("#div1").hide(); //Making the Input box element hidden
      $("#div2").show();
    };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-18
      • 2014-01-10
      • 2019-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-16
      相关资源
      最近更新 更多