Can I expand/collapse all resource items just like tasks?

Can I expand/collapse all resource items just like tasks?

I saw we could expand/collapse all task items as below, but can we expand/collapse all resource items?

Hello Kevin,
There is no public API method to do that. But you can use resourcesStore.pull to get all resources. Then you can change $open property of each resource object and render the changes. Here is an example of how it might be implemented:
http://snippet.dhtmlx.com/9c6bb0da0

Update:
You can get the resource datastore and iterate each item it has and change the $open property. Then you need to call the refresh method to repaint the changes:
https://docs.dhtmlx.com/gantt/api__gantt_datastore_other.html#:~:text=gantt.getVisibleTaskCount().-,eachItem,-(callback)%3A%20void%20-%20iterates

Here is an example of the implementation:

It works,Thanks for your help

But I can not find the API doc about the treeDataStore.pull method, could you put the specific url here?

Hello Kevin,
treeDataStore.pull is not a method. It is an object. There is no such an article that explains how it works. We’ll add that article in the future.

Thanks Ramil, I looked into the source code and found the answer, thanks for you explaining, but What I care about is, if there is no official doc for this, or public method for this, I’m afraid of future deprecation on this “illegal” using.

Hello Kevin,
Thank you for the clarification.
I cannot promise you that it will stay the same forever, but I will notify you when the article is written or declined because of new functionality.

I understand that, Thanks Ramil.

Hi Ramil,
This helped me, too. Thanks.

1 Like

Hello,
In case if you didn’t see these articles and for everyone else, here are the links for the articles that describe the datastore and tree datastore:
https://docs.dhtmlx.com/gantt/api__gantt_datastore_other.html
https://docs.dhtmlx.com/gantt/api__gantt_treedatastore_other.html