I have a DropDownChoice box that loads a list of values on load(), but when I select a value from the list, the selected value does not show up in the box, even though it appears that getModelObject() does retrieve and return the correct value (the value I selected). It's just the box does not display it. I use Wicket 6.3.0, locally tested using jetty server 6.1.26 and FireFox 17.0, JQuery Mobile 1.2.0, JQuery 1.8.3. Any suggestions or ideas?
Here is the Wicket code:
MetaProfile profile = null;
...
IModel<List<String>> oxeNodeModel = null;
oxeNodeModel = new LoadableDetachableModel<List<String>>() {
private static final long serialVersionUID = 1L;
@Override
protected List<String> load() {
try {
List<String> names = getOXENodeList();
//load the OXE node list
if (names == null)
return Collections.emptyList();
else {
return names;
}
}catch (Exception e) {
return Collections.emptyList();
}
}
};
oxeNodeBox = new DropDownChoice("oxeNode",
new PropertyModel<String>(profile, "oxeNodeName"), oxeNodeModel);
oxeNodeBox.setEnabled(true);
oxeNodeBox.setOutputMarkupId(true);
add(oxeNodeBox);
The html template is:
<tr id="oxeNodeRow" name="oxeNodeRow" style="display:none">
<td align="right" nowrap class="fieldLabel"><label for="oxeNode" wicket:id="oxeNodeLabel" class="requiredLabel">OXE Node</label></td>
<td colspan="-1"><select id="oxeNode" name="oxeNode" wicket:id="oxeNode">
<option selected>OXENode</option> </select>
</td>
</tr>
I have a bunch of DropDownChoice boxes on the same form having the same issue. However, the first DropDownChoice of the form does not have the problem, ie., it does display the selected value once I made the selection from the list. Its wicket code and html markup are below. Hopefully, someone with sharper eyes can spot the difference that could have triggered the problems:
profileTypeBox = new DropDownChoice<MetaProfileType>("type",
new PropertyModel<MetaProfileType>(profile, "type"),
Arrays.asList(MetaProfileType.values()),
new IChoiceRenderer<MetaProfileType>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(MetaProfileType object) {
return object.name();
}
@Override
public String getIdValue(MetaProfileType object, int index) {
return object.name();
}
}
);
profileTypeBox.setOutputMarkupId(true);
add(profileTypeBox);
html:
<td colspan="-1"> <select id="profileType" name="profileType" wicket:id="type">
<option>default</option>
</select> </td>
By the way, I am including the html header here too just in case it might be problem since the problem appeared after I switched from the old css header (commented out) to the standard jquery mobile includes:
<html xmlns:wicket="http://wicket.apache.org/">
<head>
<!-- meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="css/custom.css" media="only screen and (max-width: 480px)"/>
<link rel="stylesheet" type="text/css" href="css/default.css" media="only screen and (min-width: 1025px)"/>
<link rel="stylesheet" type="text/css" href="css/portrait.css"
media="all and (max-device-width: 1024px) and (orientation:portrait)"/>
<link rel="stylesheet" type="text/css" href="css/landscape.css"
media="all and (max-device-width: 1024px) and (orientation:landscape)"/>
<meta name="viewport" content="user-scalable=no, width=device-width"/>
<link rel="stylesheet" href="css/iphone-style-checkboxes.css" type="text/css"/>
<script type="text/javascript" src="js/iphone-style-checkboxes.js"></script-->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"> </script>
</head>