on 04-12-2010 1:24 PM
Hi,
I have implemented a RadioButtonGroupByIndex as follow:
String[] monthNames = new String [] {
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December",
};
//1. Create context elements for node "MonthsOfYear"
List monthsOfYear = new ArrayList();
for (int i = 0; i < monthNames.length; ++i) {
IPrivateMainView.IMonthsOfYearElement month =
wdContext.createMonthsOfYearElement();
month.setMonthName(monthNames<i>);
monthsOfYear.add(month);
}
//2. Bind node to element list
wdContext.nodeMonthsOfYear().bind(MonthsOfYear);
//set lead selection
wdContext.nodeMonthsOfYear().setLeadSelection(5);
I have created an onSelect event on the RadioButtonGroupByIndex. I am trying to retreive the index of the selected radio button to enable an edit field. When trying to display the id of the selected radio button, the result is "0" for each one of them. How come the index is not 0 for the first one, 1 for the second... ?
Thanks in advance for your help.
Thibault
int selectedIndex = wdContext.nodeMonthsOfYear().getLeadSelection();
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You might also change your code to
String[] monthNames = new String [] {
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December",
};
for (int i = 0; i < monthNames.length; ++i)
{
IPrivateMainView.IMonthsOfYearElement e = wdContext.createAndAddMonthsOfYearElement();
e.setMonthName(monthNames<i>);
}
and put it into a supply function for the context node.
Armin
Hi Thibault,
Please try this :
IPrivateMainView.IMonthsOfYearElement month = null;
for (int i = 0; i < monthNames.length; ++i)
{
month = wdContext.createMonthsOfYearElement();
month.setMonthName(monthNames<i>);
wdContext.nodeMonthsOfYear().addElement(month);
}
//set lead selection
wdContext.nodeMonthsOfYear().setLeadSelection(5);
Hope it helps
Regards
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In fact this is not the way I would do it. I have associated an event on the redioButtonGroupByIndex. When a user click on one of the buttons, the onActionSelected function is called. Its parameters are the event and the radio button key. When trying to display this key, its value is 0 for each button...
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.