我需要在Struts2 - jQuery项目中实现一个多选下拉列表。
我正在使用 sj:select 标签使用 AJAX 和 JSON 从操作类加载数据。
但是,我需要将列表设置为下拉列表,并可以选择多项选择。
我尝试使用 http://code.google.com/p/dropdown-check-list/但这不适用于 sj:select 标签。
这是我的代码:-
<s:url var="list2URL" action="licenseGeneration" />
<s:form id="subgroupForm" action="licenseGeneration" method="get"
theme="css_xhtml">
<table>
<tr>
<td>
<div>Select Product Family:</div>
</td>
<td><sj:select href="%{list2URL}" id="selectedSubgroup"
onChangeTopics="featuresList,productsList" name="selectedSubgroup"
list="subgroups" emptyOption="false" headerKey="-1"
headerValue="Please select a Sub Group">
</sj:select></td>
</tr>
<tr>
<td>
<div>Select Product Name:</div>
</td>
<td>
<div>
<sj:select href="%{list2URL}" id="selectWithReloadTopic"
formIds="subgroupForm" reloadTopics="productsList"
name="products" list="productLevelSKUs" emptyOption="false"
headerKey="-1" headerValue="Please Select a Product">
</sj:select>
</div>
</td>
</tr>
<tr>
<td>
<div>Select Features:</div>
</td>
<td>
<div>
<sj:select href="%{list2URL}" id="selectWithReloadTopic2"
formIds="subgroupForm" reloadTopics="featuresList"
name="features" list="featureLevelSKUs" emptyOption="false"
headerKey="-1" headerValue="Shift select for multiple features"
multiple="true">
</sj:select>
</div>
</td>
</tr>
</table>
</s:form>
只需使用简单的 HTML,因为波纹管就可以工作
<select multiple="multiple">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>