Hi, I am quite new to wicket and got 2 questions about DropDownChoice don't
know how to solve even after some googling as well from this forum so need
some helps again:
1. I want to get the current selected item's value from DropDownChoice, I
was looking for something like
DropDownChoiceObject.selectedValueOrID() - something equitvalent, I saw the
example from wicket website, it's using:
DropDownChoice ddc =
new DropDownChoice("name",
new PropertyModel(employee, "managedBy"),
new LoadableDetachableModel() {
...
}
);
so do I have to pass in a PropertyModel to achieve what I want? mine is:
final Map<String, String> choiceMap = new HashMap<String,
String>();
final List<String> jpNameString = new ArrayList();
for (JobProfile j : jobProfiles){
choiceMap.put(String.valueOf(j.getId()), j.getName());
jpNameString.add(String.valueOf(j.getId()));
}
IChoiceRenderer renderer = new ChoiceRenderer() {
public Object getDisplayValue(Object object) {
return choiceMap.get(object);}
public String getIdValue(Object object, int index) {
return object.toString();
}
};
final DropDownChoice ddc = new DropDownChoice(
"filterByJobProfileName", jpNameString, renderer)
2. my second question is how to use event OnSelectionChange, I saw two
events from the API, one is final so I can't overide, one is pretected:
final void onSelectionChanged()
protected void onSelectionChanged(java.lang.Object newSelection)
I can't use either like:
final DropDownChoice ddc = new DropDownChoice( "filterByJobProfileName",
jpNameString, renderer){
void onSeclectionChanged(){
//I want to do somethign here if this is working :(
}
};
Many thanks for your help!
--
View this message in context:
http://www.nabble.com/DropDownChoice---how-to-get-the-current-selected-value-and-I-can%27t-use-OnSelected-event-as-well-%3A%28-tf4627230.html#a13212219
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]