Hey there,
This is just a guess!!
Why are you creating a new SelectOption?;
SelectOption selectedOption = new
SelectOption(selectOption[0].getKey(), "Selected Value");
when you could just use the one that exists (selectOption[0])? The
PropertyModel doesn't make sense, ether. I'd remove that line above, and the
property model and maybe go for, in total;
ChoiceRenderer<SelectOption> choiceRenderer = new
ChoiceRenderer<SelectOption>("value", "key");
final IModel<SelectOption> iModel = new
Model<SelectOption>(selectOption[0]);
final DropDownChoice<SelectOption> postCategoriesDropDown = new
DropDownChoice<SelectOption>("postCategories", iModel,
Arrays.asList(selectOption), choiceRenderer);
Like I said, it's a guess, but those things look strange to me... sure other
people could help better. Hope it helps...
Cheers,
Col.
-----Original Message-----
From: kshitiz [mailto:[email protected]]
Sent: Wednesday, 18 April 2012 2:51 AM
To: [email protected]
Subject: Re: Wicket cannot find id in inner enclosure...but has no problem in
outer one!!!
I have removed inner enclosure and its working fine. I am facing another
problem. This is my code:
ChoiceRenderer<SelectOption> choiceRenderer = new
ChoiceRenderer<SelectOption>("value", "key");
SelectOption selectedOption = new
SelectOption(selectOption[0].getKey(), "Selected Value");
final IModel<SelectOption> iModel = new
PropertyModel<SelectOption>(selectedOption.getValue(), "value");
final DropDownChoice<String> postCategoriesDropDown = new
DropDownChoice("postCategories", iModel, Arrays.asList(selectOption),
choiceRenderer);
Select Option is :
public class SelectOption {
private int key;
private String value;
public SelectOption(int key, String value) {
this.key = key;
this.value = value;
}
/ getters and setters
}
Now here, drop down is being rendered in markup..
*<select wicket:id="postCategories">
</select>
*
But the as given in the code, I want a particular value to come as default
value. But the default one is coming out 'Choose One'. What is the issue??
But
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-cannot-find-id-in-inner-enclosure-but-has-no-problem-in-outer-one-tp4559666p4565376.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
EMAIL DISCLAIMER This email message and its attachments are confidential and
may also contain copyright or privileged material. If you are not the intended
recipient, you may not forward the email or disclose or use the information
contained in it. If you have received this email message in error, please
advise the sender immediately by replying to this email and delete the message
and any associated attachments. Any views, opinions, conclusions, advice or
statements expressed in this email message are those of the individual sender
and should not be relied upon as the considered view, opinion, conclusions,
advice or statement of this company except where the sender expressly, and with
authority, states them to be the considered view, opinion, conclusions, advice
or statement of this company. Every care is taken but we recommend that you
scan any attachments for viruses.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]