Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task row_height doesn't work as expected #100

Open
RafaelKC opened this issue Sep 6, 2023 · 1 comment
Open

Task row_height doesn't work as expected #100

RafaelKC opened this issue Sep 6, 2023 · 1 comment

Comments

@RafaelKC
Copy link

RafaelKC commented Sep 6, 2023

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
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants