Page 1 of 2

[INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Tue Nov 08, 2022 3:36 pm
by lxxrxns

Is it possible to have a resource group collapsed by default on page load?
I know I can grid.collapseAll() to collapse all groups when the page loads, but can I also do this for a single group?

As a case example, I have a group for "ex employees" (i.e. those who have left us) and I want to display them in the scheduler, but in a group that is collapsed by default so they don't take up space if you don't open that group.

Would this be possible, either by setting a property on the group, or by collapsing said group with javascript after the page loads? I couldn't find anything in the docs on this.

Thank you.


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Tue Nov 08, 2022 5:36 pm
by mats

Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Tue Nov 08, 2022 7:01 pm
by lxxrxns

Hi mats! That looks useful. Was this a feature in Bryntum 4.x also? (I'm still running version 4).
And if so, how would you implement this? I'm getting scheduler.toggleCollapse() is not a function.


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Tue Nov 08, 2022 9:28 pm
by marcio

Hey lxxrxns,

You need to use like this grid.features.group.toggleCollapse(recordOrId, collapse)


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Wed Nov 09, 2022 12:00 am
by lxxrxns

Hi marcio,

This returns

Uncaught TypeError: Cannot read properties of undefined (reading 'group')

Any idea?


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Wed Nov 09, 2022 6:15 am
by tasnim

I tested it in our online example and it works fine. Could you please provide us a runnable test case so we can debug and give you the solution easily?


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Fri Nov 25, 2022 11:12 pm
by lxxrxns

Hi tasnim,

I have been testing it in this online example:

https://www.bryntum.com/products/scheduler/examples/groupsummary/

But when I add

scheduler.features.group.toggleCollapse(1, true);

it gives me an error: Cannot read properties of undefined (reading 'isGroupHeader')

I'm guessing the ID (I tried 1, 2, 3, 10, etc). of the group is incorrect, but how can I tell what the ID is of the group that I want to collapse?

Can you please show me how to collapse one of the groups in the example above, and how you select which group to collapse?


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Sat Nov 26, 2022 11:40 am
by marcio

Hey lxxrxns,

If you check the resourceStore in the example (one way to check is to write scheduler.features.group.resourceStore in the console), you'll see that the id of the resources is not 1,2,3, and so on. And we have registered for the groups as well, so if you run

scheduler.features.group.toggleCollapse('group-header-Consultants');

You'll see the toggle working correctly.


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Sun Nov 27, 2022 1:58 pm
by lxxrxns

Hi marcio,

while scheduler.features.group.toggleCollapse('group-header-Consultants'); indeed works,
doing scheduler.features.group.resourceStore in the console on the example gives me an "undefined" response, so I am still unable to figure out the id's of my own groups.

So I'm wondering, is scheduler.features.group.resourceStore correct? Or should it be something else to get an overview of the groups and their id's?

Thanks again.


Re: [INFO REQ] Scheduler/Grid: Collapse a resource group by default?

Posted: Mon Nov 28, 2022 6:37 am
by tasnim

Hello,
You can not get the resourcesStore like this
scheduler.features.group.resourceStore

to get the resources store you can use this instead scheduler.features.group.store this will return the resourceStore

Good Luck :),
Tasnim