<div class="layui-form-item layui-form-text" > <label class="layui-form-label"><span style="color:red;">* </span>多选</label> <div class="layui-form" style="margin-left:130px;"> <select name="sheshi" xm-select="selectId" id="sheshi"> <option value="">--请选择--</option> </select> </div> </div> <input type="hidden" id="hiddensheshi" name="hiddensheshi" value="${sysEntertainment.sheshi}">
var diclistsheshi = ${diclistsheshi}; //后台用model存的List<Map<String,String>> if(diclistsheshi != "" && diclistsheshi != null ){ //在下拉框显示选项 var arr = []; var lis = $("#hiddensheshi").val(); for(var i = 0;i<diclistsheshi.length;i++){ var arrStr = {name:diclistsheshi[i].dicname,value:diclistsheshi[i].dicnum}; arr.push(arrStr); } formSelects.data(‘selectId‘, ‘local‘, { arr: arr }); //渲染之前选中的(业务编辑功能用的到) //取出之前已经选中的编码 1101,1103,1105,1107 var lis = $("#hiddensheshi").val(); var lisarr = lis.split(","); formSelects.value(‘selectId‘,lisarr,true); }else{ hint("获得酒店设施失败", true); }
原文地址:https://www.cnblogs.com/gjths/p/11175272.html
时间: 2024-10-28 11:25:22