DataTables qui ne se charge pas

DataTables qui ne se charge pas

solo190solo190 Posts: 2Questions: 0Answers: 0

bonjour a tous
je galère depuis hier sur un Data,
le json est bon mais les données ne sont pas chargé dans le tableau surement je n'adresse pas bien la source de donnée
mon json et le sous cette forme

{"root_detail_reports":[{"login":"xxxx","sender":"xxxx","date_envoie":"2021-03-10 03:10:00"},{"login":"xxxx","sender":"xxxx,"date_envoie":"2021-03-10 02:51:00"}]}

ma requette est la suivante

$.ajax({
'url': "../ss/detail_reports.php",
'method': "POST",
'dataType': 'text',
data:{date_debut: datedebut, date_fin: datefin}, 
}).done( function(root_detail_reports) {
    console.log(root_detail_reports);
    $('#mytabledetail').DataTable( {
        "aaData":'root_detail_reports',
      "columns": [
          {root_detail_reports:"login"},
       {root_detail_reports:"sender"},
       {root_detail_reports:"date_envoie"}

        ]
    })
})

l'erreur rencontré est la suivante

DataTables warning: table id=mytabledetail - Requested unknown parameter '1' for row 0, column 1.
Merci de votre apport

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited June 2021

    Your columns is wrong - the root_detail_reports elements should be data,

    Colin

  • solo190solo190 Posts: 2Questions: 0Answers: 0

    thank colin ,
    when i do like this , i have this error .
    DataTables warning: table id=mytabledetail - Requested unknown parameter 'login' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Take a look at this here - http://live.datatables.net/wefohege/1/edit

    I had to fix the data, quotes and commas were missing, but the data is loading.

    Colin

Sign In or Register to comment.