How to clear AdvTreeview in virtual mode

Just wondering how to clear an AdvTreeview operating in virtual node. It looks like when calling ClearNodes or ClearNodeList it's just refreshing - calling OnGetNumberOfNodes and OnGetNodeText .
The reason I'd like to clear the treeview is I have a number of external filters (checkboxes, dates etc) that affect the treeview data, and I'd ideally like to clear the treeview if these are changed (to ensure the treeview doesn't show data not matching the filters) then do a manual refresh once the filters have all been configured! At the moment I'm setting a flag when the filters change, and then have OnGetNumberOfNodes return ZERO if this is set, but this seems a bit of a clunky way of doing things!
Is there a method I can call that will just clear the treeview without refreshing the data?
Thanks for your help!

When using AdvTreeView in virtual mode, the nodes aren't actually stored internally but are fetched on-demand through events like OnGetNumberOfNodes and OnGetNodeText. Because of this, calling ClearNodes or ClearNodeList doesn't clear stored nodes as it normally would—it just triggers a refresh and re-queries your event handlers.

Unfortunately, there isn't a built-in method to "clear" the virtual nodes without triggering a refresh because AdvTreeView fundamentally relies on those events to provide nodes whenever asked.

Your current approach of using a flag to temporarily return zero from OnGetNumberOfNodes is actually a common and valid pattern to effectively "clear" the tree visually when your filter settings change. This way, the tree shows no nodes until your filters have been applied and the data source is ready.

Ah, ok. Thanks for confirming. I'll carry on using this method.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.