简体   繁体   English

在Pentaho CDE中选择组件

[英]Select component in Pentaho CDE

I have a select component which has two options and a button. 我有一个选择组件,它具有两个选项和一个按钮。 According to the options in the select component charts will be displayed in the dashboard. 根据选择的组件中的选项,图表将显示在仪表板上。 "Option1" in the drop down list is the default option so in the click action of the button I have written the following code to make "Option1" the first option. 下拉列表中的“ Option1”是默认选项,因此在按钮的单击操作中,我编写了以下代码,使“ Option1”成为第一个选项。

$("#LongestActivation_LongestTypeDD option:first").attr("selected", true);  

As soon an option is selected from the select component a javascript code is fired. 一旦从选择组件中选择了一个选项,就会触发JavaScript代码。 But when I have the above code it does not get fired the first time but only gets fired the second time. 但是,当我拥有上面的代码时,它不会被第一次触发,而只会第二次被触发。 Is there any other way I can make "Option1" the default option without using the above code? 还有其他方法可以使“ Option1”成为默认选项,而无需使用上面的代码吗?

I had the same problem. 我有同样的问题。 I use a trick, add a first element into "values array" with no text and the same id that your default. 我使用了一个技巧,将第一个元素添加到“ values array”中,不包含任何文本,并且具有与默认值相同的ID。

在此处输入图片说明 The problem with my solution the selector is clicked, an empty first options is showed. 我的解决方案的问题是单击选择器,显示为空的第一个选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM