Hi, I followed the tutorial you gave about Javascript sourced data.
My problem is, when I get my datas from a json, they are like this :
[["Pierre","Vincent","Vincent","Vivien","Pierre","Vivien","Khaled","Jeremy","Frederic","Pierre","Vivien","Tom","Frederic","Vivien","Jean-Vitus","Khaled","Romain","Matheo","Jean-Vitus","Khaled","Frederic","Tom","Pierre","Vincent"],["Aveyron nature","Aveyron nature","Green citizen","Renecore Apps","NS Interne","NS Interne","NS Interne","NS Interne","NS Interne","TRACK","TRACK","TRACK","TRACK","FormBuilder","ecoReleve Data","ecoReleve Data","ecoReleve Data","ecoReleve Data","Tuyaux (Bonna)","Tuyaux (Bonna)","Data Centralization","eCollection","ecoBalade","AO"],["21","27","19","4","13","13","22","54","3","18","4","32","10","23","23","9","33","46","16","7","38","18","7","6"]]
So there is 3 tables, the first one is for the hours, the second one is the employes, the third is the projects they worked one, so for exemple "Pierre worked 21h on Aveyron nature"
So I use a method to convert the result and put it in a variable with this method :
var getdatafromurlNEW = function(myurl)
{
var exist = null;
console.log("getdatafromurlNEW", myurl);
$.ajax({
url: myurl,
async: false,
success: function(result){
exist = result;
},
error: function(xhr){
console.log("error NEW", xhr);
DemanderNouveauSprint();
}
});
return (exist);
console.log('coucou',exist)
};
Add the datas of the json in a variable :
var test = getdatafromurlNEW("http://localhost/ScrumManager/api/www/action/gethourdown/105");
(the http://localhost/ScrumManager/api/www/action/gethourdown/105 is just the json result, the 3 tables )
So then I add the datas of the variable in the datable like this :
$(document).ready(function() {
$('#datatable').DataTable({
data: test,
columns: [
{ title: "employes" },
{ title: "project" },
{ title: "hours" }
]
} );
} );
And then I got this : (picture "resultat.pnj" or here )
I guess it's because how I fill my json.
I logged the result of the variable too if it can help, it look like this -> here
I can save each array in a different variable too
var employes = test[0];
var project = test[1];
var hours = test[2];
Any way to fix it ?
Thanks