I create a table composed by 3 table like that:
As you can see the Months data content is inside an horizontal scroll div, and it's work well. This is Odoo qweb engine but it's rendered as html...
.table-grid {
width: 100% ;
overflow-x: auto;
white-space: nowrap;
padding-bottom: 15px; /* Avoid scroll over data */
}
table, th, td {
border: 1px solid black;
}
th, td {
padding: .5em 1em;
}
<div class="table-grid">
<table class="timesheet-table">
<thead>
<tr>
<!-- Load month days columns -->
<!-- record month_days is a n-upla like (week_day_name, day, month_name) -->
<t t-foreach="month_days" t-as="day">
<th t-att-height="th_height">
<h5><div><t t-esc="day[0]"></t></div></h5>
<h6><t t-esc="day[2]"/> <t t-esc="day[1]"/></h6>
</th>
</t>
</tr>
</thead>
<tbody>
<t t-foreach="range(projects_num)" t-as="project">
<tr>
<t t-foreach="month_days" t-as="day">
<td>
00:00
</td>
</t>
</tr>
</t>
</tbody>
</table>
</div>
Is there a way to achieve this in a single table?
So let scrollable only center content (less first column and last).
I try to put the <div class="table-grid">
inside <tr>
after some <td>
but this doesn't work.
Here is the code that i try:
<table class="timesheet-table">
<thead>
<tr>
<th t-att-height="th_height">Projects</th>
<t t-foreach="month_days" t-as="day">
<th t-att-height="th_height">
<h5><div><t t-esc="day[0]"></t></div></h5>
<h6><t t-esc="day[2]"/> <t t-esc="day[1]"/></h6>
</th>
</t>
<th t-att-height="th_height">Totals</th>
</tr>
</thead>
<tbody>
<t t-foreach="range(projects_num)" t-as="project">
<tr>
<td>
Nome progetto
</td>
<div class="table-grid">
<t t-foreach="month_days" t-as="day">
<td>
00:00
</td>
</t>
</div>
<td>
45:00
</td>
</tr>
</t>
</tbody>
</table>
It's possible to achieve this in a single table?