load() で値のリストをロードする DropDownChoice ボックスがありますが、リストから値を選択すると、getModelObject() が値を取得して返すように見えても、選択した値がボックスに表示されません。正しい値 (選択した値)。ボックスが表示されないだけです。私は Wicket 6.3.0 を使用しており、Jetty サーバー 6.1.26 と FireFox 17.0、JQuery Mobile 1.2.0、JQuery 1.8.3 を使用してローカルでテストされています。提案やアイデアはありますか?
ウィケットのコードは次のとおりです。
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);
html テンプレートは次のとおりです。
<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>
同じ問題を抱えている同じフォームに多数の DropDownChoice ボックスがあります。ただし、フォームの最初の DropDownChoice には問題はありません。つまり、リストから選択すると、選択した値が表示されます。その改札コードと html マークアップを以下に示します。うまくいけば、目の鋭い人が問題を引き起こした可能性のある違いを見つけることができます:
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>
ちなみに、古いcssヘッダー(コメントアウト)から標準のjqueryモバイルインクルードに切り替えた後に問題が発生したため、問題が発生する可能性がある場合に備えて、ここにもhtmlヘッダーを含めています。
<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>