We have an estimated hours field that we would like to have set as duration rather than the auto-calculated duration from start date to end date, which is in unit: days.
Our goal is to have unit of the duration field in hours so that way when we assign a resource, it does not extend the task duration out based on duration in days, but the duration in estimated hours.
Sounds like you need to change default value for durationUnit field
class MyTask extends TaskModel {
static get fields() {
return [
{ name : 'durationUnit', defaultValue : 'hour' }
];
}
}
const gantt = new Gantt({
...
project : {
// Let the Project know we want to use our own MyTask model with custom fields
taskModelClass : MyTask,
Yes, please see in attachment. I've used sample from gantt-5.1.5/examples/frameworks/react/javascript/basic
and add custom task model to change duration unit to hour as
class MyTaskModel extends TaskModel {
static get fields() {
return [
{ name : 'durationUnit', defaultValue : 'hour' }
];
}
}
Result is OK for display duration as
hour
but horizontal bar not show. Please help me to review. Thanks.
If you set defaultValue for the TaskModel duration as an hour, and didn't send that value from the server side, it might affects on all duration values in your tasks.
You don't see the scrollbar because there is no need to scroll. A project is fully visible on the screen.
But that's only my guess. Please attach a runnable test case, so we will be able to check your entire situation.