Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
Build object tasks for gantt.parse

The question is pretty trivial, but my level of programming doesn't allow me to solve it.

I'm trying to build an object, for display. Built it first with simple push method, then I realized there is an error and something is wrong.

Step by step, first I make ajax request to api server. I get data array, then I form object during enumeration. Example:

data = [];
$.ajax(settings).done(function (response) {
  obj = response.result.tasks;
  Object(obj).forEach(function (entry, index) {
    console.log(entry);
    startDatePlan = entry.startDatePlan.substring(0, 10);
    endDatePlan = entry.endDatePlan.substring(0, 10);
data.push ({id: entry.id, text:entry.title, start_date: startDatePlan, end_date: endDatePlan})    
  })
}); 

The output I get is an array like this:

[
    {
        "id": "7852",
        "text": "D#3628 7852",
        "start_date": "2021-10-21",
        "end_date": "2021-11-05"
    },
    {
        "id": "7854",
        "text": "D#3628 7854",
        "start_date": "2021-10-06",
        "end_date": "2021-10-21"
    },
    {
        "id": "7856",
        "text": "D#3628 7856",
        "start_date": "2021-09-28",
        "end_date": "2021-10-06"
    }
]

But this array doesn't work, having compared it to the demo version. I see that my properties are not defined as numbers and dates. But I can't figure out how to build the array correctly.

I even tried filling the object and pushing it into the array. But I faced with indices, which are not used in the demo.

gantt.parse({
    data:[
        {id:1, text:"Project #2", start_date:"01-04-2013", duration:18},
        {id:2, text:"Task #1",    start_date:"02-04-2013", duration:8,
            progress:0.6, parent:1},
        {id:3, text:"Task #2",    start_date:"11-04-2013", duration:8,
            progress:0.6, parent:1}
    ],
    links:[
        { id:1, source:1, target:2, type:1},
        { id:2, source:2, target:3, type:0}
  ]
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Let's continue our discussion here:

https://forum.dhtmlx.com/t/question-build-object-tasks-for-gantt-parse/73313

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda