on 12-27-2005 7:13 AM
Hi
I have a 2 dimentional array returned from EJB like String [] [] myarray.Now using this array how to populate a dropdown list with this.
Thanks in advance.
Ananda
Hi Ananda,
1. Create a Dropdown UI element in your View
2. In the view context, create a value attribute("X") and assign it to the dropdown UI element.
Do some modifications to mentioned code below and add it in your VIEW implementation.
ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext
().getModifiableTypeOf("X");
IModifiableSimpleValueSet values=myType.getSVServices
().getModifiableSimpleValueSet();
for (int i=0; i< <Your ArraySize>; i++)
{
//Insert Another loop (you array is two dimensional)
values.put(<value from array>, <value from array>);
}
Thanks
Senthil
P.S. Reward Points for useful/helpful answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please read the Javadoc
Armin
Hi All
I have succesfully populated the 2 dropdown list box where the contents of the second dropdown depends on the first BUT with one DEFECT:
When changing the first drop down each time the previous elements of the second dropdown are NOT erased out;
How to refresh the second drop down ?
Thanks
Ananda
Do I understand you correctly, you want to change the value set of the second drop-down list after selection of an item in the first drop-down list?
Then you could do this:
In the selection handler for the first drop-down list, get the DDIC type (modifiable simple type) of the context attribute used for the second drop-down list and <b>replace </b>its value set according to the selected key in the first drop-down list.
Armin
Message was edited by: Armin Reichert
Hello Armin You are correct I have done it already what you have said BUT in the second dropdown new values are ADDED to the previous one's.
SO what I want is to completely delete the values of the second dropdown and create a new dropdown list when the first drop down changes.
Thanks in Advance
Ananda
Hello Anandha,
U can put the required logic in the OnSelect event of the First dropdown.
The following is a pointer code for doing the same.
/*** modiableType of Second dropdown
ISimpleTypeModifiable mySecondType =
wdControllerAPI.getContext()
.getModifiableTypeOf("<modifiableType of Second DropDown>");
IModifiableSimpleValueSet secondSetOfValues =
mySecondType.getSVServices()
.getModifiableSimpleValueSet();
String Name = wdContext.currentContextElement().getName_Char();
int i = wdContext.nodeClasscharvalues_Output().size();
<b>/*** Clear the values in the second dropdown ***/
secondSetOfValues.clear();</b>
/*** Populate the values in the second dropdown based on some logic ***/
for (int valueList = 0;valueList < i; valueList++ )
{
IWDNodeElement element =
wdContext.nodeClasscharvalues_Output()
.getClasscharvalues_OutputElementAt(valueList);
Sring NameStr = (String)element.getAttributeValue("Name_Char");
if(Name.equalsIgnoreCase(NameStr))
{
secondSetOfValues.put((String)element.getAttributeValue("Char_Value") ,
(String)element.getAttributeValue("Char_Value"));
}
}
Please reward appropriate points
Bala
Message was edited by: Bala Krishnan
Hi,
In the onSelect() action of firstdropdown,
add this piece of code to clear the values in 2nd Dropdown and populate with fresh values.
onSelectFirstDropDown()
{
ISimpleTypeModifiable myType=wdThis.wdGetAPI().
getContext().getModifiableTypeOf(<Att Name mapped to 2nd dropdown>);
IModifiableSimpleValueSet valSet = myType.getSVServices
().getModifiableSimpleValueSet();
valSet.clear();
// Add piece of code to populate the 2nd dropdown list
}
Hope this helps.
Thanks
Senthil
User | Count |
---|---|
74 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.