Datatable Fonction jQuery qui ne marche que sur la 1ère page
Bonjour,
J'ai un simple Datatable qui fonctionne bien.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <form id="form_table" method="POST" class="card-body" style="background-color: transparent;">
<div class="table-responsive">
<table class="table table-bordered" id="users">
<thead><?php echo $head;?></thead>
<tfoot><?php echo $head;?></tfoot>
<tbody>
<?php
foreach ($_SESSION['users'] as $key => $user) { ?>
<tr>
<td>
<td>
<button type="button" class="button">Button</button>
</td>
<td>
<?php echo $user['nom'].' '.$user['prenom'];?>
</td>
<td>
<?php echo $user['tel'];?>
</td>
<td>
<?php echo $user['portable'];?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</form> |
Aussi dans la première colonne j'ai un bouton de class="button"
lié à une fonction jQuery :
Code:
1 2 3
| $('.button').on('click',function(){
console.log('Ok');
}); |
>> On click sur le bouton > ca affiche Ok dans la console,
Je m'aperçois que cette fonction ne marche que sur la première page du tableau
et pas sur les autres.
L'initialisation du tableau:
Code:
$('#users').DataTable({});
Auriez-vous une idée ?