DHTMLX / gantt

GPL version of Javascript Gantt Chart
https://dhtmlx.com/docs/products/dhtmlxGantt/
GNU General Public License v2.0
1.48k stars 324 forks source link

Task row_height doesn't work as expected #100

Open RafaelKC opened 1 year ago

RafaelKC commented 1 year ago

Hi, I`m using licensed gantt in version 8.0.4, I'm trying to set task.row_height as below:

gantt.attachEvent('onBeforeTaskChanged', (taskId: string) => { const task = gantt.getTask(taskId); task.row_height = 100; gantt.render(); })

But it`s affect just the task bar height. I have multiples task in same row.

image

gearcoded commented 1 year ago

@RafaelKC, It is not expected to change the task parameters in the onBeforeTaskChanged event as it fires after you dragged a task, but before the changes are applied. Please clarify why you need to do that and what result you want to get.

Also, it seems that you have the split tasks. After you change the row_height for a child task, it doesn't affect the row_height of the parent tasks, Gantt just doesn't have that functionality. You will need to manually update that parameter for all parent tasks that are rendered in the split mode. You can use the eachParent method to iterate all parent tasks: https://docs.dhtmlx.com/gantt/api__gantt_eachparent.html

Here is an example of how it can be implemented:

gantt.attachEvent('onBeforeTaskChanged', (taskId) => {
    const task = gantt.getTask(taskId);
    task.row_height = 100;
    gantt.eachParent(function(parent){
        parent.row_height = 100;
    }, taskId);

    gantt.render();
    return true
})

https://snippet.dhtmlx.com/1kinyh4c