Hi,
I debugged the source code. The problem is in following class
org.csstudio.opibuilder.properties.StringListProperty:
public Object checkValue(Object value) {
if(value == null)
return null;
List<String> acceptableValue = null;
if(value instanceof List){
if(((List<?>) value).size() == 0 ||
(((List<?>) value).size() > 0 && ((List<?>) value).get(0) instanceof String))
acceptableValue = (List<String>)value;
}
return acceptableValue;
}
So unless the value is a java.util.List, the property will not be set. There needs to be a conversion step somewhere which either converts a String to a java.util.List or org.mozilla.javascript.NativeArray to a java.util.List.
Cheers,
Xinyu
On 14/02/2013, at 9:52 PM, Pavel Maslov wrote:
Hi Xinyu,
I am experiencing the same problem with CSS 3.1.4.
In theory, display.getWidget("BitFileComboBox").setPropertyValue("items", "[choice1, choice2, choice3]"); should work.
Since when I getPropertyValue of the manually set widget I get [1, 2, 3].
Strange, indeed.
On Thu, Feb 14, 2013 at 2:00 PM, <[email protected]<mailto:[email protected]>> wrote:
Hi,
I have a combo box, and I would like to set its items (ie the available options) dynamically using a javascript.
I tried the following and it did not work.
display.getWidget("BitFileComboBox").setPropertyValue("items", "[choice1, choice2, choice3]");
I also tried array object and it did not work either:
var mycars = new Array();
mycars[0] = "choice1";
mycars[1] = "choice2";
mycars[2] = "choice3";
display.getWidget("BitFileComboBox").setPropertyValue("items", mycars);
Thanks,
Xinyu WU
ASKAP Computing
Australia Telescope National Facility
CSIRO Astronomy and Space Science
phone: +61 2 9372 4727
postal: PO Box 76 Epping, NSW. 1710
--
Best regards,
Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia
Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01
Xinyu WU
ASKAP Computing
Australia Telescope National Facility
CSIRO Astronomy and Space Science
phone: +61 2 9372 4727
postal: PO Box 76 Epping, NSW. 1710
- References:
- How to set property 'items' of ComboBox from a javascript in CSS BOY Xinyu.Wu
- Re: How to set property 'items' of ComboBox from a javascript in CSS BOY Pavel Maslov
- Navigate by Date:
- Prev:
Re: How to set property 'items' of ComboBox from a javascript in CSS BOY Pavel Maslov
- Next:
Redundancy Steven Goff
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: How to set property 'items' of ComboBox from a javascript in CSS BOY Pavel Maslov
- Next:
Redundancy Steven Goff
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|