Hi all!
I want to display a lot of categorized data with a treeview component.
Instead of loading the data all at once, i want to run a script that updates the dataset when one of the expand button is pressed.
Is there a way to detect when the expand button is pressed?
Pressing this:
![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/32a98c2135e8f485074544390863e921a995ef60.png)
Instead of this:
![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/0/00242606d19e80a1d82473de01567f766e232343.png)
Yes, this is technically possible, by accessing the inner Swing JTree and adding a listener to it:
However, I'm pretty sure just overwriting the dataset won't work - it will immediately collapse all the nodes again.
We don't have any readily available examples of generating a properly lazy tree.
If you don't mind some Swing hacking, you could create your own tree model and populate it with instances of our com.inductiveautomation.ignition.client.util.gui.tree.AbstractLazyLoadingTreeNode
class entirely using scripting. That class has an abstract loadChildren()
method on it that will be fired to actually initialize each node as it's expanded.
3 Likes
I suggest that you start a new thread and tag it as perspective. Don't mix this one up.