http://datatables.net/tn/18 error mensage

http://datatables.net/tn/18 error mensage

clovissardinhaclovissardinha Posts: 2Questions: 1Answers: 0
edited February 2023 in Free community support

****The table codigo****

<table id="myTablePesquisa" class="table table-striped table-bordered  my-5">
    <tr>
    <td colspan="5" class="text-center text-uppercase"><h3> Cargo Pesquisado :  <?php echo !empty($cargos[0]['nome_cargo'])? $cargos[0]['nome_cargo'] :'Nenhum registro encontrado' ?></h3></td>
    </tr>
    <div class="container">
      <?php if(!empty($cargos[0]['nome_cargo'])): ?>
    <tr class="text-left">
      <th >nome</th>
      <th >órgão</th>
      <th >destino</th>
      <th >cadastrado em:</th>
    </tr>
    
    <?php foreach ($cargos as $cargo) : ?>

    <tr>
        <td class="text-left text-uppercase"><?php echo $cargo['nome'] ?></td>
        <td class="text-left text-uppercase"><?php echo $cargo['nome_orgao'] ?></td>
        <td class="text-left"><?php foreach($cargo['id_user'] as $key=>$cidade):?>
          <?php echo $cidade['cid_nome']  ?> <?php endforeach ?></td>
        <td><?php echo date('d/m/Y', strtotime( $cargo['created_at'])) ?></td>
       
     <td align="left"> <?php foreach($cargo['id_user'] as $usuario):?><?php endforeach ?>
        <?php $user= implode(',',$usuario) ?>
        <?php $user= explode(',',$user) ?>
        
          <a href="<?php echo base_url('UserAdmin/Usuario/getUsuarioByIdCargo')."/".$user[1] ?>"target="_blank">DETALHES
        </a> </td>
    </tr>
        <?php endforeach ?> 
        <?php endif ?>
    </div>
</table>

debbuger:

Table information
Summary information about the DataTables on this page.
Information about 1 table available

myTablePesquisa

Data source: DOM
Processing mode: Client-side
Draws: 0
Columns: 0
Rows - total: 0
Rows - after search: 0
Display start: 0
Display length: 10
Version check
Check to see if your page is running the latest DataTables software.
LibraryInfoInstalledLatest
DataTablesUp to date1.13.21.13.2
AutoFill-2.5.2
Buttons-2.3.4
ColReorder-1.6.1
Editor-2.1.0
FixedColumns-4.2.1
FixedHeader-3.3.1
KeyTable-2.8.1
Responsive-2.4.0
RowGroup-1.3.0
RowReorder-1.3.2
Scroller-2.1.0
SearchBuilder-1.4.0
SearchPanes-2.1.1
Select-1.6.0
Check for common issues
Run automated tests to check for common and previously reported issues.
15 tests complete. No failures or warnings found!
----------ooooooooooooooo------------------------------
Controller (codeigniter 4)

public function buscarCargo(){
 
            $session = \Config\Services::session();  
            $request = \Config\Services::request();
            $pager = \Config\Services::pager();

        if($session->get('logged_in')){
        $post=$request->getPost();
        if($post){
            $cargos=$this->cargoModel->buscaCargoById($post['cargo']);
            
           //dd($cargos);
            foreach($cargos as $key=> $cargo){
                $cargos[$key]['id_user']=$this->destinoModel->getDestinoById($cargo['id_user']);
               }
        $dados=[
        'nome'=> $session->usuario,
        'logged_in'=>$session->logged_in,
        'cargos'=>$cargos,
        'post'=>$post,
        ];
        //dd($dados);
    echo view('UserAdmin/Cargo/final',$dados);
        }
    }
        else{
        return redirect()->to('/Login');
        }
    }

Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

This question has an accepted answers - jump to answer

Answers

  • clovissardinhaclovissardinha Posts: 2Questions: 1Answers: 0

    I forgot to say that the table in the screen is perfect. See below.

    CARGO PESQUISADO : ADVOGADO(A)
    nome órgão destino cadastrado em:
    CARLA CHABUDER PREFEITURA MUNICIPAL Barra do Pirai 02/07/2013 DETALHES
    KARLA SOBIESKI GOVERNO DO ESTADO Sao Paulo 31/10/2014 DETALHES
    MARITANIA SECRETARIA ESTADUAL DA CRIANÇA E JUVENTUDE Joao Pessoa 10/01/2015 DETALHES
    LAIS LOBO PREFEITURA MUNICIPAL Cascavel Toledo Corbelia Rio do Salto Ceu Azul 27/05/2015 DETALHES
    PAULA PROCURADORIA GERAL DO ESTADO Fortaleza 13/08/2015 DETALHES

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    Answer ✓

    https://datatables.net/manual/tech-notes/18
    18. Incorrect column count

    Did you follow the troubleshooting steps in the link provided?

    Looks like you have 4 columns defined in your thead and 5 columns defined in the tbody.

    Kevin

Sign In or Register to comment.