有没有办法在现有的刀片表中增加行和列。我已经根据问题表和联系人使用 foreach 循环填充数据。我需要计算表中分数列的平均数、最小值和最大值,联系人和问题标签根据所选调查内容而有所不同。
@php
$FIXED_COLUMN_COUNT =5;
$columnCount = $FIXED_COLUMN_COUNT + count($questionLabels);
$rowCount = count($contacts) + 3;
@endphp
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Email</th>
<th>StartDate</th>
<th>EndDate</th>
<th>Score</th>
@foreach($questionLabels as $questionLabel)
<th>{{ $questionLabel}}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($contacts as $contact)
<tr><td></td></tr>
.
.
.
..
.@foreach(answers as answer)
<tr><td></td></tr>
.
.
.
..
@endforeach
Here i need max, min and average inside the table
</tbody>
</table>
</div
我想要这样的输出。在这里输入图像描述
像这种情况,我使用了jQuery,你必须导入 jQuery.js 然后试试这个
<script>
$('#tableId tr:last').after('<tr>...</tr><tr>...</tr>');
</script>
或
<script>
$('#tableId > tbody:last-child').append('<tr>...</tr><tr>...</tr>');
</script>