I have a temple that render a table using a struct that represents all the data.
The template look like this.
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">DataTables Example</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
#for(colums in page.table.columns) {
<th>#(colums)</th>
}
</tr>
</thead>
<tfoot>
<tr>
#for(colums in page.table.columns) {
<th>#(colums)</th>
}
</tr>
</tfoot>
<tbody>
#for(row in page.table.rows) {
<tr>
#for(data in row.datas) {
<td>#(data)</td>
}
</tr>>
}
</tbody>
</table>
</div>
</div>
</div>
For this scenario this works. But let's say in another page I have a different data structure. So not page.table
but page.grid.table
how can I still use this template?
My initial though was to change the template ta use table.columns
instead of page.table.columns
and then "assign" the the table variable right before I embed the template. This way you could also have multiple table if you like and just re-assign the table
before you embed it.
I'm not very experience with web-development so maybe I'm just thinking of this wrong.