No data available in table

No data available in table

DieuControleDieuControle Posts: 3Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown: No data available in table
Description of problem: The data is displayed correctly in datatable but I still have this message No data available in table Can you help me.
Thank you in advance

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,140Questions: 26Answers: 4,735

    My guess is you are initializing the Datatable to a blank HTML table. After initialization you are adding rows to the table without using Datatables API's like rows.add(). So Datatables doesn't know about the added rows. You might be able to use rows().invalidate() after adding the rows. Or maybe better is to initialize Datatables after adding the rows or use Datatables to add the rows. Hard to say without actually seeing what you are doing.

    Kevin

  • DieuControleDieuControle Posts: 3Questions: 1Answers: 0

    Thank you for your response and please excuse me for the time taken. The data comes from an API that I retrieve. using the angular * ngFor directive that I display the data in the DataTable. I take a capture of my code.

  • DieuControleDieuControle Posts: 3Questions: 1Answers: 0


    this is my code

  • kthorngrenkthorngren Posts: 20,140Questions: 26Answers: 4,735
    Answer ✓

    I'm not familiar with Angular but the method you are using to load the table data is directly populating the HTML. If you are initializing Datatables before calling getCahmberList() then Datatables wont know about the data that you added. You can initialize Datatables after getCahmberList() or use one of the methods I described above to have Datatables update its data cache.

    Kevin

  • aremou1010aremou1010 Posts: 1Questions: 0Answers: 0

    @DieuControle , do you find the solution ?

  • msaadhassan92msaadhassan92 Posts: 1Questions: 0Answers: 0
    edited October 2020

    .

  • AymanElshehawyAymanElshehawy Posts: 1Questions: 0Answers: 0

    @DieuControle

    ">">Add This check :smiley:

    <table *ngIf="chambres.length"

Sign In or Register to comment.