Please help me I can't add mult checkbox to my table
Please help me I can't add mult checkbox to my table
{% extends 'base.html.twig' %}
{% block title %}Marcar Presença | Personalizado{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.18/css/dataTables.jqueryui.min.css">
<link rel="stylesheet" href="//gyrocode.github.io/jquery-datatables-checkboxes/1.2.11/css/dataTables.checkboxes.css">
<link rel="stylesheet" href="{{ asset('build/css/dataTables.bootstrap.css') }}">
<link rel="stylesheet" href="{{ asset('build/css/changeDataTable.css') }}">
{% endblock %}
{% block body %}
<section class="content-header">
<h1>
Marcar Presença
<small>dos Candidatos</small>
</h1>
<ol class="breadcrumb">
<li><a href="{{ path('index') }}"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Candidaturas</a></li>
<li><a href="#">Exame de Acesso</a></li>
<li><a href="#">Turmas</a></li>
<li class="active">Marcar Presença Personalizado</li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
{% for message in app.flashes('sucesso') %}
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-check"></i> Successo!</h4>
{{ message }}
</div>
{% endfor %}
{% for message in app.flashes('erro') %}
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
{{ message }}
</div>
{% endfor %}
<div class="box">
<div class="box-header">
<h3 class="box-title">Marcar Presença | Personalizado (Turma: {{ turma.nome | upper }})</h3>
</div>
<form action="" method="POST">
<!-- /.box-header -->
<div class="box-body">
<div class="box-footer ">
{% if turmaCandidatos is not empty %}
<button type="submit"
class="btn btn-facebook btn-info pull-right">{{ button_label|default('Registar') }}</button>
{% endif %}
</div>
<table id="minhaTabela" class="table table-bordered table-striped">
<thead>
<tr>
<th></th>
<th>Nome do Candidato</th>
<th>Ndi</th>
<th>Data de Nascimento</th>
<th>Telefone</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{% for turmaCandidato in turmaCandidatos %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ turmaCandidato.getCandidato.nomeCompleto | upper }}</td>
<td>{{ turmaCandidato.getCandidato.ndi | upper }}</td>
<td>{{ (turmaCandidato.getCandidato.dataNascimeto | date('d-m-Y'))| upper }}</td>
<td>{{ turmaCandidato.getCandidato.telefone | upper }}</td>
<td>{{ turmaCandidato.getCandidato.email }}</td>
</tr>
{% if loop.length < 1 %}
<tr>
<td class="text-center" colspan="9">Nenhum dado encotrado.</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
</section>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src="//gyrocode.github.io/jquery-datatables-checkboxes/1.2.11/js/dataTables.checkboxes.min.js"></script>
<script src="{{ asset('build/js/carregarDataTable.js') }}"></script>
<script>
$(document).ready(function (){
var tabelam = $('minhaTabela').DataTable({
columnDefs: [
{
targets: 0,
checkboxes: {
selectRow: true
}
}
],
select: {
style: 'multi'
},
order: [[1, 'asc']]
});
}
);
</script>
{% endblock %}
Answers
What´s the wrong on my code?
Thats a lot of code to dig through. Can you post a link to your page or a test case showing the issue?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Are you getting any errors (alert or browser console)?
What happens, does the Datatable display but without the checkbox?
In order to help we need more details and a running example replicating the issue.
Kevin