Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
HTML table DOM element not found - TableFilter

I have a simple html div <div id="data_table"></div> and I try to load its content from a csv. I build the table succesfully and see it rendered. Hovewer, I want to add a TableFilter, but it seems the element does not exist in DOM.

I get:

Uncaught Error: Could not instantiate TableFilter: HTML table DOM element not found.

<script>
   $(document).ready(function () {
        $.ajax({
          url: "static/data.csv",
          dataType: "text",
          success: function (data) {
            var employee_data = data.split(/\r?\n|\r/);
            var table_data = '<table class="table table-bordered table-striped">';
            for (var count = 0; count < employee_data.length; count++) {
              var cell_data = employee_data[count].split(",");
              table_data += "<tr>";
              for (var cell_count = 0;cell_count < cell_data.length;cell_count++){
                if (count === 0) {
                  table_data += "<th>" + cell_data[cell_count] + "</th>";
                }else {
                  table_data += "<td>" + cell_data[cell_count] + "</td>";
                }
              }
              table_data += "</tr>";
            }
            table_data += "</table>";
            $("#data_table").html(table_data);
          },
        });
        
        var tf = new TableFilter("data_table", {
          base_path: "static/tablefilter/",
          alternate_rows: true,
        });
        tf.init();

      });
</script>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Solved: Had to change <div id="data_table"></div> to <table id="data_table"></table> in the HTML.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda