I work on a cakephp app. In my index views, I want to fix the table headers. I saw this question and tried to use it, but did not work in my case.
<?= $this->Paginator->paginator() ?>
<table class="hoverTable dataTable">
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('name') ?></th>
<th><?= $this->Paginator->sort('erial_number') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($assets as $asset): ?>
<tr>
<td><?= $asset->id ?></td>
....
<td class="actions">
<?= $this->Html->iconButton('glyphicon-eye-open', __(''), [
'controller' => 'Assets',
'action' => 'view', $asset['id']])
?>
....
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
in my CSS, I have:
.hoverTable{
border-collapse: collapse;
margin: 12px 0 0 0;
width: 100%;
}
.hoverTable th {
padding: .6em 1em;
background: #d0f0e9;
font-weight: bold;
border:#edfdf9 1px solid;
}
.hoverTable td{
padding-bottom: 12px;
}
}
.hoverTable tr:hover {
background-color: #eff6f5;
}
I tried to add this to my CSS but did not work:
.hoverTable thead
{
display: block;
overflow: auto;
}
.hoverTable tbody
{
display: block;
height: 200px;
overflow: auto;
}
Any help please ?