0
I am developing two applications one web (service) and another mobile (consumes the service), in apk the user send Formularies to the web application, hence I would like to create a kind of notification for each new form that the server receives. Similar to what’s on the stack overflow site itself. How could I do that?
And already on the page where it lists all the received Formularios, how could a Reload in the datatable without having to update the whole page?
My list of incoming formularies in the web application:
#{extends 'main.html' /}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" charset="utf8"
src="//code.jquery.com/jquery-1.12.4.js"></script>
<!-- JQUERY DATATABLE -->
<script type="text/javascript">
$(document)
.ready(
function() {
$('#myTable3')
.DataTable(
{
"language" : {
"sEmptyTable" : "Nenhum registro encontrado",
"sInfo" : "Mostrando de _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty" : "Mostrando 0 até 0 de 0 registros",
"sInfoFiltered" : "(Filtrados de _MAX_ registros)",
"sInfoPostFix" : "",
"sInfoThousands" : ".",
"sLengthMenu" : "_MENU_ resultados por página",
"sLoadingRecords" : "Carregando...",
"sProcessing" : "Processando...",
"sZeroRecords" : "Nenhum registro encontrado",
"sSearch" : "Pesquisar",
"oPaginate" : {
"sNext" : "Próximo",
"sPrevious" : "Anterior",
"sFirst" : "Primeiro",
"sLast" : "Último"
},
"oAria" : {
"sSortAscending" : ": Ordenar colunas de forma ascendente",
"sSortDescending" : ": Ordenar colunas de forma descendente"
}
}
});
});
</script>
<div class="panel panel-default">
<div class="panel-body">
<input type="hidden" name="denuncia.id" value="${d?.id}" />
<table id="myTable3"
class="table table-striped table-bordered table-over">
<thead>
<tr>
<th>Nome</th>
<th>Rua</th>
<th>Bairro</th>
<th>Cidade</th>
<th>Data</th>
</tr>
</thead>
<tbody>
#{list items:denuncias, as:'d'}
<tr>
<td>${d.nome}</td>
<td>${d.rua}</td>
<td>${d.bairro}</td>
<td>${d.cidade}</td>
<td>${d.data}
<div class="pull-right action-buttons">
<a href="@{denuncias.remover(d.id)}" class="trash" data-toggle="confirmation" data-btn-ok-label="Sim" data-btn-ok-class="btn-success" data-btn-cancel-label="Não"
data-btn-cancel-class="btn-danger" data-title="Remover denuncia" data-content="Tem certeza que deseja excluir este registro?"><span class="glyphicon glyphicon-trash"> Remover</span></a>
<a href="@{denuncias.detalhes(d.id)}" class="flag"><span class="glyphicon glyphicon-eye-open"> Detalhes</span></a>
</div>
</td>
</tr>
#{/list}
</tbody>
</table>
The data in this table
#myTable3
don’t seem to be being loaded with datatables. Apparently you use a kind of server-side template engine to create the entire table, and when it arrives at the client you apply the datatables. This makes it difficult for you to make the datatables give a Reload without reloading the page. For this you would have to use atable.ajax.reload();
, in accordance with documentation. To update the page you could use sockets or make ajax requests regularly.– Juven_v
Look at this, it’s kind of what you want to do, it can help: reply
– Tecnologia da Net