【发布时间】:2020-07-26 13:20:03
【问题描述】:
我有一个引导表,它通过循环显示我的 mongoDB 集合中的数据。我试图在我的表的最后一个td 上使用rowspan,称为“其他”,以跨越到表的末尾。但是,因为它是一个循环,所以它会创建一个嵌套的 rowspan 并弄乱表格。有没有办法让行跨度不会像这样嵌套?它需要在forEach 循环中,因为数据是从我的名为环境的集合中提取的,它只能在forEach 中使用(如果在循环之外使用它会给我错误“环境未定义” )
表格的html:
<table class="table">
<thead>
<tr>
<th scope="col">Something</th>
<th scope="col">Code Version</th>
<th scope="col">Region</th>
<th scope="col">Something</th>
<th scope="col">Something</th>
<th scope="col">Something->Membership</th>
<th scope="col">SBMO</th>
<th scope="col">Something</th>
<th scope="col">IVR</th>
<th scope="col">CPM</th>
<th scope="col">Other</th>
</tr>
</thead>
<tbody>
<!-- loop through each entry in mongoDB collection: environment -->
<% environment.forEach(function(environment){ %>
<tr>
<td>
<%= environment.something %>
</td>
<td>
<%= environment.codeVersion %>
</td>
<td>
<%= environment.region %>
</td>
<td>
<%= environment.something %>
</td>
<td>
<%= environment.something %>
</td>
<td>
<%= environment.membership %>
</td>
<td>
<%= environment.SBMO %>
</td>
<td>
<%= environment.something %>
</td>
<td>
<%= environment.IVR %>
</td>
<td>
<%= environment.CPM %>
</td>
<!-- this is the td that i'm having issues with -->
<td rowspan=50 class="other">
<%= environment.other %>
</td>
</tr>
<% }); %> <!-- end loop through environment -->
</tbody>
</table>
<td rowspan=10 class="other"><%= environment.other%></td> 上的检查器元素:
【问题讨论】:
-
您能分享一下您遇到问题的论文 td 中的检查员元素吗?
-
@JérômeW 刚刚添加了截图
-
我加了一个答案,试试看告诉我怎么回事^^
标签: html twitter-bootstrap foreach html-table ejs