Our state of the art Gantt chart


Post by rayudu.pasumarthy »

Hi,

We are utilizing the Resource Utilization Widget. On applying a filter on the data, the tasks get filtered out accurately but the total hours consider both filtered and non filtered tasks.

Steps:

  1. Open Resource Utilization Examaple (https://bryntum.com/examples/gantt/resourceutilization/)

  2. Place the following code at the end:

resourceUtilization.project.on('load', source => {
      console.log(resourceUtilization.store.allRecords);
 resourceUtilization.store.addFilter({
          id: 'nameFilter',
          filterBy: record => record.origin.event != null && record.origin.event.name == 'Configure ports'
        });
    });

3 . Tasks will get filtered but the total effort considers filtered tasks

resUtil_filtered_scenario.png
resUtil_filtered_scenario.png (133.72 KiB) Viewed 392 times

Is it possible to allow the total effort to only consider the available tasks? We have utilized getBarText (https://bryntum.com/docs/gantt/api/SchedulerPro/view/ResourceUtilization#config-getBarText) but it does not have the ResouceUtilizationStore object available.

Thanks,
Rayudu.


Post by alex.l »

The easiest way to get a store - from resource record. getBarText has a resource record in params, and all resources records has a link to the store. check resource.store
or resource.firstStore

All the best,
Alex


Post by rayudu.pasumarthy »

Hi,

We have utilized resource.firstStore and we get the ResourceStore through this. But the filter was applied to the ResourceUtilizationStore (resourceUtilization.store.addFilter()). Even the resources records are linked to the ResourceStore but not to the ResourceUtilizationStore. We're not able to get the ResourceUtilizationStore through the ResourceStore which prevents us from checking if the assigned task if filtered or not.

Is it possible to access the ResourceUtilizationStore instead of the ResourceStore?

Thanks,
Rayudu


Post by alex.l »

I see. No, not from the default scope or params, unfortunately. I've opened a ticket to make it possible https://github.com/bryntum/support/issues/4704

For now, you could try to change a scope of your method or use some global variable to get that.

All the best,
Alex


Post by arcady »

Closed the ticket since it's trivial to reach both the view and its store:

new ResourceUtilization({
    getBarText(datum) {
        // view is ResourceUtilization instance
        const view = this.owner;
        // view.store is corresponding ResourceUtilizationStore instance
        view.store

Post Reply