Hi, I'm doing a gantt with js, I'm using frappe gantt, but at the moment of performing the function to generate it I get this error
the text you see arriva is console.log (tasks). Here is a sample of my js:
/*Llamar generacion de grantt*/
function generar_diagrama(data){
var tasks=data;
console.log(tasks)
setTimeout(function(){
var gantt = new Gantt('#gantt', tasks, {
on_view_change: function() {
var bars = document.querySelectorAll(" .bar-group");
for (var i = 0; i < bars.length; i++) {
bars[i].addEventListener("mousedown", stopEvent, true);
}
var handles = document.querySelectorAll(" .handle-group");
for (var i = 0; i < handles.length; i++) {
handles[i].remove();
}
}
});
},500)
}
//DIAGRAMA DE GRANTT
/*Consulta de datos*/
var json;
$.ajax({
url: "diagrama",
type:"POST",
dataType:"html",
data:{},
success:function(data){
generar_diagrama(data);
}
});
And my controller and model query:
Controller:
public function diagrama()
{
$id=$this->input->post("id");
$data=$this->Home_model->diagrama($id);
echo json_encode($data);
}
Model:
public function diagrama($id)
{
$query= $this->db
->select('t.id as id,t.fecha_inicio as start ,t.titulo as name,t.fecha_fin as end,t.porcentaje as progress')
->from("tareas as t")
->join('usuario', 't.usuario1 = usuario.id')
->get();
return $query->result();
}
and the index object:
<svg id="gantt"></svg>
The strange thing is that if instead of setting the value 'data' to 'tasks', I put the text that the 'console.log' prints if it works ...