<script type="text/template" id="testDataChildTpl">//<!--
<td class="width-35">
<select id="ChildList{{idx}}_name" name="ChildList[{{idx}}].name" class="form-control ">
<c:forEach items="${fns:getDictList('item_materialname')}" var="tt">
<option value="${tt.value}" >${tt.label}</option>
</c:forEach>
<select>
<td class="width-35">
<select id="ChildList{{idx}}_name" name="ChildList[{{idx}}].name" class="form-control ">
<c:forEach items="${fns:getDictList('item_materialname')}" var="tt">
<option value="${tt.value}" >${tt.label}</option>
</c:forEach>
<select>
</td>
</script>
<script type="text/javascript">
var testDataChildRowIdx = 0, testDataChildTpl = $("#testDataChildTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
$(document).ready(function() {
var data = ${fns:toJson(markItem.childList)};
for (var i=0; i<data.length; i++){
addRow('#ChildList', testDataChildRowIdx, testDataChildTpl, data[i]);
testDataChildRowIdx = testDataChildRowIdx + 1;
//自己写的select option 不回显,要自己实现如下:注意pxx要加单引号和双引号
var pxx=data[i].name;
$("#ChildList"+i+"_name").find("option[value='"+pxx+"']").attr("selected",true);
}
});
</script>