Tree lister expand all

Please what would be recommended way of performing expand on all rows in Tree lister? I can see there is Collapse All pulse, but I haven’t found the opposite. Going through its internal methods I am not sure which one would be the most appropriate to call for this. Thanks :slight_smile:

Ah, strangely there is no Expand All function. I looked into it and it’s a bit of a trick to build. Will take a look at this soon. If it’s important to you, I can send you a preview if I get it working.

1 Like

Thanks for help, that would be great. However I am still trying to decide if I could use Tree lister (for the thing I am trying to do), or if I would have to built it directly in List COMP. In case I would be able to use Tree lister, I would be happy to experiment with any preview, but for now I don’t want to rush you into anything :slight_smile:

(I am looking for Expand All option just to prevent frame drops caused by clicking on expand button. I want to display just a couple of entries in some kind of a tree view, so I figured it would be best to expand them right away and not worry about the drops caused by expanding later.)

So eventually it seems that I could use Tree lister for my use-case. Therefore if you might have some kind of a preview in the future, I would certainly make use of it. Thanks. :slight_smile:

In case someone might be interested in a quick and dirty solution in the meantime:

def ToggleChildren(id, obj):
	tle = op('treeLister').ext.TreeListerExt
	if len(obj['__children__']) > 0:
		for child, childObj in obj['__children__'].items():
			ToggleChildren(child, childObj)

tle = op('treeLister').ext.TreeListerExt
for id, obj in tle.json.items():
	ToggleChildren(id, obj)

I guess it works just for a small group of scenarios (the ones that use Table with “path” col). :slight_smile:

1 Like

Nice! Also, if you do this instead, you guarantee that all branches open, otherwise they will just swap (open children will close and closed children will open.)

tle.ToggleExpand(obj['path'], True)

Ah, yes, that’s true, thanks :slight_smile:

Hello @Ivan,
I have just looked at new Expand All parameter in 2023 treeLister and it seems to sometimes have funky behavior hidden in it :slight_smile: I have found scenarios where it swaps between collapse / expand all and also one where it fails at second click. Would you like me to send some examples?

Yes send examples!

Here are two funky examples I have found :slight_smile:
expand_all_examples.toe (36.7 KB)