Our state of the art Gantt chart


Post by hien.nguyen »

Hi team,

I got problem about change duration unit, I can change it to hour by return data from api and add property durationUnit = hour ==> this setting is OK for old task.

1.png
1.png (54.11 KiB) Viewed 469 times

Problem happen on add new task: duration unit back to day. Please share me the way to set it to hour

2.png
2.png (29.55 KiB) Viewed 469 times

Best regards.


Post by marcio »

Hey hien.nguyen,

You'll need to extend the default TaskModel and update the default value of durationUnit field
https://bryntum.com/products/gantt/docs/api/Gantt/model/TaskModel#field-durationUnit

class MyTaskModel extends TaskModel {
    static get fields() {
        return [
            { name : 'durationUnit', defaultValue: 'hour' }
        ];
    }
}

And then update your project configuration

const
    project = new ProjectModel({
        taskModelClass : MyTaskModel,
        // ...other configurations

or inside your Gantt configuration

 gantt = new Gantt({
        appendTo : 'container',
        project  : {
        taskModelClass : MyTaskModel,
        // ...other configurations
 

Best regards,
Márcio


Post by hien.nguyen »

Yes,

It's ok but I got new problem: horizontal bar will disappear after I add taskModelClass into project

project = new ProjectModel({
        taskModelClass : MyTaskModel,

It's related to https://github.com/bryntum/support/issues/5512.

Have debugged with @JockeLindberg, and it seems to be doing what it should. Closing ticket as invalid

It mean: no need to fix anything?

BTW, current I used version 5.1.5. Now I need to upgrade to 5.2.4 for fix this bug?

Best regards.


Post by alex.l »

Hi hien.nguyen,

When you change default value for TaskModel, all duration values will be interpreted as value in new durationUnit units, if these tasks doesn't have own value in record data.

BTW, current I used version 5.1.5. Now I need to upgrade to 5.2.4 for fix this bug?

No, the team decided this is expected behaviour.

All the best,
Alex


Post by hien.nguyen »

Yes,

durationUnit is OK, but new problem I got about: horizontal bar not display?

My problem related with above git issue #5512 and detail in topic viewtopic.php?t=20176

Best regards.


Post by hien.nguyen »

Hi team,

I still have problem with no horizontal bar, please help me.

Best regards.


Post by alex.l »

horizontal bar not display?

Do you have something to scroll? I see full project is displayed on the viewport, so nothing to scroll, that's why no scrollbar appeared.
Does it look different for you?

Please check recommendations from this post, if you want to always have a scrollbar viewtopic.php?p=112846#p112846

Let us know if it helped or not.

All the best,
Alex


Post Reply