Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

edu.belchior's avatar

DHTMLXGantt dont save/update tasks

I am using DHTMLXGantt in a project that I am developing, I can load activities, but when I make a change or insert a new activity it does not save the changes, so I saw this process is automatic, I followed the steps in this tutorial: https://dhtmlx.com/blog/using-dhtmlxgantt-with-laravel/

  public function data()
 {
    $connector = new GanttConnector(null, "PHPLaravel");
    $connector->render_links(new GanttLinks(), "id", "source,target,type");
    $connector->render_table(new 
        GanttTasks(),"id","text,start_date,duration,progress,type,parent,open");
 }

  <script type="text/javascript">

    // Exibe a porcentagem de conclusão da atividade
    gantt.templates.progress_text = function(start, end, task){
        return "<span style='float:left;margin-left:3px;color:#FFF'>
         <b>"+Math.round(task.progress*100)+ "%</b></span>";
    };

    // Exibe os responsáveis pela atividade
    gantt.templates.rightside_text = function(start, end, task){
        if(!task.users)
            return "<b>Responsáveis: </b> Indefinido";
        else
            return "<b>Responsáveis: </b>" + task.users;
    };

    // Realiza a "auto-programação" do projeto e de atividades com dependências
    gantt.config.auto_scheduling = true;
    gantt.config.auto_scheduling_strict = true;
    gantt.config.auto_scheduling_initial = true;

    // Faz a verificação de atividades criticas
    gantt.config.highlight_critical_path = true;

    // Permite a adição de novas colunas
    gantt.config.add_column = true;

    // Informa que a tabela da esquerda e o gráfico podem ser redimensionados lateralmente
    gantt.config.grid_resize = true;

    // Seta uma largura inicial para a tabela de atividades
    gantt.config.grid_width = 430;


    // Seta os inputs para adicionar uma nova atividade
    gantt.config.lightbox.sections = [
        {name:"description", height:38, map_to:"text", type:"textarea", focus:true},
        {name: "type", type: "typeselect", map_to: "type"},
        {name: "time", height: 72, type: "duration", map_to: "auto"}
    ];

    // Converte o formato padrão (d-m-Y) para o recebido do json
    gantt.config.xml_date = "%Y-%m-%d";

    // Inicializa o gráfico
    gantt.init("gantt");

    // Busca os dados do banco de dados
    gantt.load("/cronograma/buscar");

    // Apenas para debug
    $.get(
        "/cronograma/buscar",
        function(data) {
            console.log(data);
        }
    );

    var dp=new gantt.dataProcessor("/cronograma/gantt_data");
    // Inicializa o gráfico
    dp.init(gantt);


   </script>

CONSOLE/NETWORK:

   <data>
 <action type="error"  sid="5" tid="5"/>
   </data>
0 likes
0 replies

Please or to participate in this conversation.