Discuss anything related to web development but no technical support questions


Post 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.


Post by mats »


Post 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.


Post by marcio »

Hey lxxrxns,

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

Best regards,
Márcio


Post by lxxrxns »

Hi marcio,

This returns

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

Any idea?


Post 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?


Post 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?


Post 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.

Best regards,
Márcio


Post 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.


Post 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


Post Reply