Hello,
we would like to know if it’s possible to configure the Resource Utilization widget to use a custom field instead of the default effort field.
In our implementation, each assignment includes a custom field called manualEffort, which serves the same purpose as effort but is manually entered by the user, and not calculated based on units. This allows users to define the number of hours they want to allocate to a resource directly.
Is there a way to achieve this customization, or would it require significant changes to the widget's behavior?
Hello Alex,
thank you for your reply. Unfortunately, after applying your suggestion, I'm getting errors in the console. I'm not sure what's causing them. We are using version 6.2.1.
Below is the code where I followed your instructions:
You'll have to change calculateAllocation method code. It iterates over working time intervals and collects effort. And you should change it to accrue provided effort values across the intervals duration.
Hello Arcady,
we're trying the solution you suggested, but we've encountered an issue: ResourceAllocationInfo is a type, not a class, so we can't extend it as described in your message and in the documentation.
Are we missing something?
Yes, the ticket is not resolved yet I'm afraid. So proper type definition is not available for that class until the ticket is done.
That means so far TypeScript will be angry with such subclassing. You can try @ts-ignore some code to workaround the problem.
The class is there but it's just its *.d.ts interface is messed up. Sorry for the inconvenience!
Please let us know if ts-ignore helped.
Then I'm afraid you'll have to wait till the ticket is resolved.
Well you can of course edit @bryntum/gantt/gantt.d.ts file manually and replace ResourceAllocatioInfo type definition with export class ResourceAllocationInfo {
but that's a bad practice since you'll loose the change after any further upgrade.
It seems I've found a workaround that at least should unblock you.
The idea is you make a proxy js-file that re-exports ResourceAllocationInfo and then you make a *.d.ts file for that js-file that declares ResourceAllocationInfo as a class. For example:
I've made foo.js file looking like this:
export { ResourceAllocationInfo } from '@bryntum/gantt';
I've made foo.d.ts file next the foo.js:
import { SchedulerProResourceModel, ResourceAllocation, SchedulerProCalendarModel } from '@bryntum/gantt';
export class ResourceAllocationInfo {
/**
* Resource model.
*/
resource: SchedulerProResourceModel
/**
* The collected allocation info.
*/
allocation: ResourceAllocation
/**
* A calendar specifying intervals to group the collected
* allocation by. <strong>Working</strong> time intervals of the calendars will be used for grouping.
* This also specifies the time period to collect allocation for.
* So the first interval `startDate` is treated as the period start and the last interval `endDate` is the period end.
*/
ticks: SchedulerProCalendarModel
/**
* `true` indicates inactive events allocation is included
* and `false` - it's skipped.
*/
includeInactiveEvents: boolean
}
Then in my test application I import ResourceAllocationInfo from that foo.js:
import { ResourceAllocationInfo } from './foo.js';
And it allows to re-declare is as a class ignoring wrong declaration in the distribution.