javascript - 为什么 foreach 循环会生成重复值?
问题描述
从下表中我想获取数据。我得到的所有值但是第二个 foreach 循环为循环内的字段生成重复值
请让我知道任何建议
<div><table class="stt">
<thead>
<tr class="shade">
<th>Dep Ver</th>
<th >Order In Document Version</th>
<th>DEP Number</th>
<th>DEP Title</th>
<th>DEP Revision Date</th>
<th>Heading Hierarchy</th>
<th>Section Item No</th>
<th>SHALL[PS] Statement</th>
<th>Requirement Type</th>
<th>Discipline</th>
<th>Risk Rating (P)</th>
<th>Risk Rating (A)</th>
<th>Risk Rating (C)</th>
<th>Risk Rating (E)</th>
</thead>
</tr>
第二个 foreach 循环生成重复值
#foreach($workitem in $workitems) #set($wiType = $workitem.fields().type().optionId())
<tr>
<td> $projectId</td>
<td></td>
<td>$workitem.fields.docNumber.render </td>
#if($wiType.equals("document"))
<td>$workitem.fields().description.render()</td>
#else
<td></td>
#end
<td></td>
<td></td>
<td></td>
#if($wiType.equals("requirement"))
<td>$workitem.fields().description.render()</td>
#else
<td></td>
#end
<td>$workitem.fields().type().render()</td>
<td>$workitem.fields.discipline.render</td>
#foreach($rs in $risks)
<td>$rs.fields.P.render</td>
<td>$rs.fields.A.render</td>
<td>$rs.fields.C.render</td>
<td>$rs.fields.E.render</td>
#end
</tr>
#end
</table>
</div>
解决方案
推荐阅读
- python - 串行程序比并行程序工作得更好
- python - 为什么我的 for 循环在列表末尾返回一个空列表值?
- ruby-on-rails - Ruby on Rails 中的 Sqlite 到 Postgresql 迁移
- angular - Ionic 应用程序中的超时错误处理 - Ionic
- xamarin - 如何在 xamarin 表单中的列表视图中设置不均匀行设置为 true 的列表视图滚动位置结束
- python - OSError: [Errno 24] 打开的文件太多 python , ubuntu
- php - array_walk 中的匿名函数在 PHP 5.2 上抛出错误
- xamarin - 获取异常 Java.Lang.IllegalArgumentException:只能将 TabItem 实例添加到 xamarin 表单中的 TabLayout
- prolog - 我正在尝试使用 DCG 创建一种语言 a^nb^n-1 c^n-2 但无法使 succ(0) 处理 n
- cakephp - 致命错误:找不到类“对象”C:\xampp\htdocs\
\lib\Cake\Controller\Controller.php 第 58 行