Alinhamento DATATABLE

01/08/2018

5

Senhores!

Estou com um problema no alinhamento do Datatable. Ao clicar no collapse, o header da tabela se encontra desalinhada. Repare que ao clicar na paginação ou na ordenação da coluna, o header volta a ficar alinhado. Ou seja, o problema está apenas na execução do Collapse.

Alguém poderia me ajudar?


Obrigado!



<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">



<title>Hello, world!</title>
</head>
<body class="bg-info">

<div id="accordion" class="pt-2">
<div class="card">
<div class="card-header" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Hosts Cadastrados
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<div class="container table-responsive">
<table id="id_da_table" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th class="text-center">Nome</th>
<th class="text-center">IP</th>
<th class="text-center">Porta</th>
<th class="text-center">Ações</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center">Gerente</td>
<td class="text-center">IP 1</td>
<td class="text-center">Porta 1</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="text-center">Diretor</td>
<td class="text-center">IP 2</td>
<td class="text-center">Porta 2</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="text-center">Atendente</td>
<td class="text-center">IP 3</td>
<td class="text-center">Porta 3</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="text-center">Estagiário</td>
<td class="text-center">IP 4</td>
<td class="text-center">Porta 4</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="text-center">Manutenção</td>
<td class="text-center">IP 5</td>
<td class="text-center">Porta 5</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
<tr>
<td class="text-center">Gerente</td>
<td class="text-center">IP 1</td>
<td class="text-center">Porta 1</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="text-center">Diretor</td>
<td class="text-center">IP 2</td>
<td class="text-center">Porta 2</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="text-center">Atendente</td>
<td class="text-center">IP 3</td>
<td class="text-center">Porta 3</td>
<td class="text-center">
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Editar"><i class="fas fa-edit"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Visualizar"><i class="fas fa-eye"></i></a>
<a href="#" class="example" data-toggle="tooltip" data-placement="bottom" title="Excluir"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="text-center">Estagiário</td>
<td class="text-center">IP 4</td>
Responder

Posts

03/08/2018

Carlos Augusto

Cara,

Poderia subir seu código no codepen ou algo do tipo ?
Assim da para ver o fonte e já te ajudar.
https://codepen.io/pen/
Responder

03/08/2018

Lucas Bertelli

Segue o link conforme solicitado.<br />
<br />
https://codepen.io/lbertelli29/pen/yqEJvV/
Responder
×
+1 DevUP
Acesso diário, +1 DevUP
Parabéns, você está investindo na sua carreira