Is there a simple way to wipe the treeview when the internalFrameOpened event fires in a Navigation window?
I have a treeview that displays locations that a user is permitted to access. This list is assembled with a python function that queries a table in SQL Server to get the user’s permissions, returned as a list with each value corresponding to the tag path for a location. On load the treeview data is populated, but when the project has updates, the values duplicate. Is there a way to clear the treeview of all values so that it is essentially rebuilt with internalFrameOpened?
I’ve tried a few different options and am a bit stumped.
• I tried clearing the treeview with this, but it didn’t appear to have an effect:
dataset = system.dataset.toDataSet(headers, )
system.gui.getParentWindow(event).getComponentForPath(‘Root Container.Tree View’).data = dataset
dataset = system.dataset.toDataSet(xrefHeaders, )
system.gui.getParentWindow(event).getComponentForPath(‘Root Container’).xrefData = dataset
• Then I tried doing a check if the treeview has any data and skipping the population stage, which worked, but if a new location permission has been added since the initial project load and the project is updated, the user wouldn’t have access to the new location. So then I assembled a list of any locations that are in the view and within the code that adds the permissible locations, I added a check that if that location is already present in the data, to skip it. After updates, the debugging seems to indicate that the values are still duplicating, but then the treeview is blank afterwards.
• I tried setting the cache policy to never for the window thinking maybe it was a caching issue–that didn’t appear to be the case.