Our pure JavaScript Scheduler component


Post by markus »

Hi,

I have a bit of a bigger topic.

What I want to achieve: SchedulerPro with a connected ResourceHistogram that aggregates the resource utilization and displays the available time.

Now, we can use the TreeGroup feature for that and that works, however not for my use case.

Why? Because I use a multi-level (n levels) resource tree that I setup by providing the children/parentId for each resource. That somehow seems to contradict to the concept of using the TreeGroup feature (if I apply the TreeGroup feature to my hierarchical resources, I get no resources in the tree).

Ideally, I would be able to use the aggregation functionality (TimelineHistogramGrouping) on the ResourceHistogram without using the TreeGroup feature - is that possible?

Is there any other functionality that I could use?

Thanks,
Markus


Post by arcady »

Hello,

The component supports TreeGroup and Group features just because they the default way of grouping shipped with the component.
But it can be extended to use existing grouping API in a different way.

You can use your own custom data structure. The component decides which record is a group based on its isGroupRecord method result. Then if that's a group it tries aggregating the group's children data.

So as a start point you need to override isGroupRecord method the way you want it to work. Here for example I override the method so the component would treat any parent record as a group:

class MyResourceHistogram extends ResourceHistogram {

    isGroupRecord(record) {
        // treat any parent record as a group and aggregate data for it automatically
        return record.isParent;
    }

    ...
}

Best regards,
Arcady


Post by markus »

Hi,

Thanks a lot - but does that function exist? It's not in the docs...

Thanks
Markus


Post by ghulam.ghous »

Hi Markus,

Yes this function exists. You cannot find it in the docs because it is an internal function. You just simply needs to override it to match your needs.

Regards,
Ghous


Post by markus »

Hi Ghous,

Thanks a lot - I think I managed to implement that function.

But - anything else to configure? I still don't see aggregates values...

Thanks again


Post by ghulam.ghous »

Hi Markus,

We cannot say why it is not aggregating the values without looking at your implementation. Can you please share a runnable test case that have your implementation so we can debug it and assist you in a better way?

Regards,
Ghous


Post by markus »

Hi Ghous,

Thanks, I think I've got it working.

Thanks,
Markus


Post by ghulam.ghous »

Hi Markus,

We are glad that you got it working. If you need any further assistance, please don't hesitate to reach out to us.

Regards,
Ghous


Post Reply