3
I am trying to create a table within a modal window that is triggered / open as the user clicks on a button, but due to having too many logs it gets slow to open, so I thought of paging. Could someone show me some example ?
<!-- INICIO DA JANELA MODAL -->
<div class="modal fade" id="Modal_afil" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<label class="modal-title">Afiliada</label>
</div>
<div class="modal-body">
<div class="container theme-showcase" role="main">
<div class="page-header">
<div class="row"><!-- Inicio Cria DIV para efetuar pesquisa dos registros -->
<div class="col-sm-6 col-md-6">
<form id='ajax_form' class="form-inline ajax_form" method="GET" action="pesquisar_1.php">
<div class="form-group">
<label for="exampleInputName2">Pesquisar</label>
<input type="text" name="pesquisar" class="form-control" id="exampleInputName2" placeholder="Digitar...">
</div>
<button type="submit" class="btn btn-primary">Pesquisar</button>
</form>
</div>
</div><!-- Fim Cria DIV para efetuar pesquisa dos registros -->
<!-- Inicio da Paginacao de Resultados -->
<nav class="text-center">
<?php
//Verificar a pagina anterior e posterior
$pagina_anterior = $pagina - 1;
$pagina_posterior = $pagina + 1;
?>
<ul class="pagination">
<li>
<?php
if($pagina_anterior != 0){ ?>
<a href="index.php?pagina=<?php echo $pagina_anterior; ?>" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
<?php }else{ ?>
<span aria-hidden="true">«</span>
<?php } ?>
</li>
<?php
//Apresentar a paginacao
for($i = 1; $i < $num_pagina + 1; $i++){ ?>
<li><a href="index.php?pagina=<?php echo $i; ?>"><?php echo $i; ?></a></li>
<?php } ?>
<li>
<?php
if($pagina_posterior <= $num_pagina){ ?>
<a href="index.php?pagina=<?php echo $pagina_posterior; ?>" aria-label="Previous">
<span aria-hidden="true">»</span>
</a>
<?php }else{ ?>
<span aria-hidden="true">»</span>
<?php } ?>
</li>
</ul>
</nav>
<!-- Fim da Paginacao de Resultados -->
<!-- Inicio Tabela com registros que aparece dentro do Modal -->
<div class="row">
<table class='table table-bordered' class='pagination'>
<thead>
<tr>
<td><b>Código</b></td>
<td><b>Nome Fantasia</b></td>
<td><b>Codigo Interno</b></td>
<td><b>Nome / Razão Social</b></td>
<td><b>Endereço</b></td>
</tr>
</thead>
<?php while($rows_cursos = mysqli_fetch_assoc($resultado_cursos)){ ?>
<tbody>
<tr class='btn-default'>
<td class='get-cadcli'><?php echo $rows_cursos['codigo']; ?></td>
<td class='get-value-cadcli'><?php echo $rows_cursos['nome_fantasia']; ?></td>
<td class='get-value-cadcli'><?php echo $rows_cursos['codigo_interno']; ?></td>
<td class='get-value-cadcli'><?php echo $rows_cursos['cliente']; ?></td>
<td class='get-value-cadcli'><?php echo $rows_cursos['nome_logr']; ?></td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
<!-- Inicio Tabela com registros que aparece dentro do Modal -->
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
</div>
</div>
</div>
</div>
<!-- FIM DA JANELA MODAL -->
There is the possibility to do what you want and where you want, if you are in difficulty, post the code of what you have tried and then, we try to help.
– Rafael Augusto
so in case I try to make the pagination but I’ve worked so hard on the script that now it only gets stuck on the first page and does not go to the others when I select it, I will post the code
– user92870
@Rafaelaugusto edited the question with the code could analyze
– user92870
If you make pagination with
php
will never work, since always will update the page, you have to do withjs
– Rafael Augusto
you could refer me a tutorial, link, something to take a north of how to do
– user92870