Good afternoon, guys. Here is the code for my view, which is working correctly. It happens that I would like to make the process number (2nd <td>
), be clickable by calling another view. Is it possible?
View Code:
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.13/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.13/datatables.min.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/1.10.13/js/dataTables.bootstrap.min.js"></script></head><divclass="col-md-12">
<div class="row">
<br>
<div class="col-md-12">
<p><font size="3" face="helvetica"><strong>LISTA DE PROCESSOS</strong></font></p>
</div>
</div>
<div class="row">
<div class="col-md-4 ">
<button type="button" title="Imprimir" class="btn btn-primary hidden-print" onclick="myFunction()">
<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
<button type="button" title="Cadastrar Processo" onclick="return window.location.href = '<?= base_url('processo/cadastro/') ?>'" class="btn btn-primary btn-sm hidden-print"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> PROCESSO</button>
</div>
</div>
<br>
<div class="row">
<div class="col-md-12">
<table id="book-table" >
<thead>
<tr>
<td><b>Cliente</b></td>
<td><b>Nº do Processo</b></td>
<td><b>Parte</b></td>
<td><b>Pasta</b></td>
<td><b>Valor da causa</b></td>
<td><b>Situação</b></td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#book-table').DataTable({
"autowidth": false,
"ajax": {
url: "<?php echo site_url("processo/processos_page") ?>",
type: 'GET'
}
});
});
</script>
<script>
function myFunction() {
window.print();
}
</script>
Function Code in Controller:
public function processos_page() {
// Datatables Variables
$draw = intval($this->input->get("draw"));
$start = intval($this->input->get("start"));
$length = intval($this->input->get("length"));
$processo = $this->Processo_model->getAll();
$data = array();
foreach ($processo->result() as $proc) {
$data[] = array(
$proc->nomecliente,
$proc->nprocesso,
$proc->nomeparte,
$proc->pastaescritorio,
$proc->valorcausa,
$proc->situacao
);
}
$output = array(
"draw" => $draw,
"recordsTotal" => $processo->num_rows(),
"recordsFiltered" => $processo->num_rows(),
"data" => $data
);
echo json_encode($output);
exit();
}