Refreshing a dropdown in a power table?

Using 8.1.17 vision.

I have a power table with

	if colName == 'Location':
		locationNames = system.dataset.toPyDataSet(self.parent.parent.locationChoices)
		options = []
		for (idx, name) in locationNames:
			options.append((name, name))
		return {'options': options}

in the configureCell extension function to make a dropdown, where self.parent.parent.locationChoices is a dataset custom property that is a named query using caching.

On the same window is an ability to add a location choice. The script looks like

addedOfficeLocation= event.source.parent.getComponent('name').text
system.db.runNamedQuery('forms/VendorPurchaseOrder/form/addOfficeLocation', {'name':addedOfficeLocation})
# this is the NQ that populates the dropdown
system.db.clearNamedQueryCache('forms/VendorPurchaseOrder/form/ddOfficeLocations')
system.db.refresh(event.source.parent.parent, 'locationChoices')

However, adding a new location and then clicking the cell in the table that shows the dropdown does not update anything.

I did a little testing and found that if I make a listLocations property on the power table itself and refer to that instead in the configureCell extension like

	if colName == 'Location':
		locationNames = system.dataset.toPyDataSet(self.locationChoices)

Then this does work but only in designer in preview mode, for some reason in the client I have the same issue - adding a new location does not appear in the dropdown unless I exit and then re-open the window.

I also tried be calling the NQ directly in the configureEditor but same issues as before.

It seems like having a custom property on the power table itself which is just referring to my root container dataset is the only way that sort of works - again only in designer.

Is this a bug? Is there a way to accomplish what I am trying to do?

This code should still work fine:

2 Likes