Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda