对select下拉框的回显数据的处理
来源:互联网 发布:科比场均数据每年 编辑:程序博客网 时间:2024/06/05 02:04
一:目前在spring MVC 中使用的,---------------可以
<td><form:select path="fmItfDclIoDecl.orgCode" style="width:170px">
<c:forEach items="${dName}" var="dn"><form:option value="" label="" />
<form:option label="${dn.NAME}" value="${dn.CODE}"/>
</c:forEach>
</form:select></td>
二:在spring MVC 中使用的,失败,因为我后台传过来的是:List<Map<String,String>>,会报错,无hashmap中name,code的get, set方法,如果传过来是实体就可以了,个人感觉
<td><form:select path="fmItfDclIoDecl.orgCode" style="width:170px"><form:option value="" label="" />
<form:options items="${dName}" itemLabel="NAME" itemValue="CODE" htmlEscape="false
</form:select></td> --%>
三:原始的,回显需要在js中设置
<td><select name="fmItfDclIoDecl.orgCode" id="orgCode1" style="width:170px">
<c:forEach items="${dName}" var="dn">
<option value=""></option>
<option value="${dn.CODE}">${dn.NAME}</option>
</c:forEach>
</select></td>
<script type="text/javascript">
$(document).ready(function() {
var data = ${fmOrgDurationDays.orgCode};
/*普通的这样可以 */
$("#orgCode1").find("option[value='"+data+"']").attr("selected",true);
});
</script>
四:select2插件的,回显需要在js中设置
使用select2控件,一般是在常规的select控件上,设置一下即可(设置它的class为select2)。
<td><select name="fmItfDclIoDecl.orgCode" id="orgCode1" style="width:170px" class=
"form-control
select2
"
>
<c:forEach items="${dName}" var="dn">
<option value=""></option>
<option value="${dn.CODE}">${dn.NAME}</option>
</c:forEach>
</select></td>
<script type="text/javascript">$(document).ready(function() {
var data = ${fmOrgDurationDays.orgCode};
//select2插件的用下面的方法
$("#orgCode1").select2("val", data);
});
</script>
select2 插件的优秀博客:点击打开链接
- 对select下拉框的回显数据的处理
- 下拉刷新对数据的处理
- js对select下拉框的操作
- 对下拉框Select的操作
- selenium处理select标签的下拉框
- selenium处理select标签的下拉框
- select下拉框的数据方式
- 四、对select下拉框的处理需要标签为tagName为select的标签才方便进行操作
- select下拉框之数据回显
- select下拉框数据回显
- jq:对下拉框select的操作的总结
- selenium webdriver对下拉框的处理
- select下拉框&radio单选按钮数据的回显
- javascript对下拉列表框(select)的操作
- javascript对下拉列表框(select)的操作
- javascript对下拉列表框(select)的操作
- javascript对下拉列表框(select)的操作
- jquery对html中的下拉框select的操作
- FTPrep, 71 Simplify Path
- python enumerate的使用
- hadoop实战随笔_0713
- 关于JSP页面的basepath的作用及格式,举例详解
- NRF24L01+接收不正常的问题(只有开机才能接收到一两条数据)
- 对select下拉框的回显数据的处理
- CommonJS规范
- python安装与配置
- Nginx 安装与配置
- 313. Super Ugly Number
- springmvc框架中,在业务控制方法中写入模型变量收集参数,且使用@InitBind来解决字符串转日期类型
- HashMap和Hashtable,TreeMap的区别
- Androi四大核心组件之BroadcastReceiver
- idea 2017.1.4 破解