Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Los datos no se insertan correctamente en la etiqueta tbody de la tabla.

Tengo un problema al configurar el cuerpo en la tabla de contenido dinámico.

De hecho, el anuncio se ha configurado correctamente, pero lo más probable es que el problema sea el cuerpo; el encabezado de las columnas se muestra perfectamente, pero el contenido no.

Ver imagen abajo ( Nessun dato presente nella tabella --> No hay datos en la tabla )

¿Puede alguien amablemente ayudarme?

 var allart = JSON.parse(this.responseText); console.log(allart); var tbdy = document.createElement('tbody'); allart.Items.forEach(function (item) { let child = document.createElement("tr"); child.innerHTML = ` <td>${item.id}</td> <td>${item.titolo}</td> <td>${item.marca}</td> <td>${item.immagine}</td> <td>${item.sezione}</td> <td>${item.data}</td> `; table.appendChild(child); }) tbdy.appendChild(tr); table.appendChild(tbdy); $(document).ready(function () { $('#my-table').DataTable({ "pagingType": "full_numbers", "lengthMenu": [5, 10, 20, 50, 100, 200, 500], }); $('.dataTables_length').addClass('bs-select'); });
 <table id="my-table" class="row-border hover" width="90%"> <thead> <tr> <th class="th-sm">Id</th> <th class="th-sm">Titolo</th> <th class="th-sm">Marca</th> <th class="th-sm">Immagine</th> <th class="th-sm">Sezione</th> <th class="th-sm">Data</th> </tr> </thead> </table>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

necesita agregar tr con tbody dentro del ciclo.

 allart.Items.forEach(function (item) { let child = document.createElement("tr"); child.innerHTML = ` <td>${item.id}</td> <td>${item.titolo}</td> <td>${item.marca}</td> <td>${item.immagine}</td> <td>${item.sezione}</td> <td>${item.data}</td> `; tbdy.appendChild(child); }) table.appendChild(tbdy);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!