I'm doing a table with DataTable and paging, but I need it to have a checkbox on each line. The problem is that when I have to select all, it only selects the first page, the other ones do not take effect.
Follow Jquery:
$('#selectAll').change(function () {
$('tbody tr td input[type="checkbox"]').prop('checked', $(this).prop('checked'));
});
Follow the html:
<table id="tabela">
<thead>
<tr class="header-row">
<th><input type="checkbox" id="selectAll"><br></th>
<th>Matrícula</th>
<th>Categoria</th>
<th>Nome</th>
<th>Email</th>
<th>Núcleo</th>
<th>Cidade</th>
<th>Estado</th>
<th>Data de Incriçao</th>
<th>Documento</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ( $associados as $key => $associado)
<tr>
<td><input type="checkbox" value="{{$associado->code}}" name="id[]" class="cinput"><br></td>
<td>{{$associado->code}}</td>
<td>{{$associado->categoria}}</td>
<td>
<a href='{{URL::to("/partners/edit/$associado->id")}}'>
{{$associado->username}}
</a>
</td>
<td>{{$associado->email}}</td>
<td>{{$associado->nucleo}}</td>
<td>{{$associado->city}}</td>
<td>{{$associado->estado}}</td>
<td>{{date('d/m/Y', strtotime($associado->created_at))}}</td>
<td>
@if($associado->group_id == 1)
@if($associado->situacao == 1)
Aprovado
@elseif($associado->situacao == 2)
Pendente
@elseif($associado->situacao == 3)
Não Aprovado
@else
@endif
@else
@endif
</td>
<td>
@if($associado->quite == 1)
Quite
@elseif($associado->quite == 2)
Não Quite
@else
Excluído
@endif
</td>
</tr>
@endforeach
</tbody>
</table>