Row details with sql request

Row details with sql request

tigrou91430tigrou91430 Posts: 6Questions: 4Answers: 0

I use datatables with show extra / detailed information
In the fonction format(d), I have include this code to use request asynchrone script
'<tr>'+ '<td>Extra info:</td>'+ '<td>'+asynchrone_tri(d.id)+'</td>'+ '</tr>'+

and this is my asynchrone fonction
function asynchrone_tri(id) { var data = null; // Instanciation grâce au browser getXhr(); // On ouvre une requêtre asynchrone : 'true' xhr.open('POST', '../thumbails/thumbails0.php', true); // Fonction appelée quand la requête change d'état xhr.onreadystatechange = function() { // Si la requête est terminée if (xhr.readyState == 4) // Si la réponse ne contient pas d'erreur if (xhr.status == 200) { alert(xhr.responseText); return xhr.responseText; } //else // Erreur //document.getElementById("liste_agences").innerHTML = 'Erreur serveur !'; } xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // On envoie la requête // n=document.getElementById("n").value; data = "idplanches=" + id + "&reportvisible=true"; xhr.send(data); }

But in my table, I have a "undifined" value in the td.

Can you help me, please?

Answers

  • tigrou91430tigrou91430 Posts: 6Questions: 4Answers: 0

    It is ok for me.
    Thank you

  • searching_infosearching_info Posts: 2Questions: 0Answers: 0

    Hello,
    Please, could you tell me how did you solve this problem?

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    edited February 2017

    DataTables doesn't have to use all of the data that is given to it in the displayed columns. So you can just include the extra information in a JSON property that is not displayed in a column.

    Allan

  • searching_infosearching_info Posts: 2Questions: 0Answers: 0

    Thank you Allan

This discussion has been closed.