Power Table Drop Down List - Named Query

Hi,

I need to add drop down list to power table cell. I have added following code to ConfigureEditor extension function.
None drop down list is displayed when I select ‘Work_Centre’ column. Could you help me to find the problem.

if colName == 'Work_Centre':
	query = system.db.runNamedQuery("WorkCentres_NotAll", {})
	RoleList = []
	for row in query:
                thisList = []
		for item in row:
			thisList.append(item)
			RoleList.append(thisList)		
		return {'options': RoleList}

Welcome to the forum! Quick tip – if you put three backticks (`) before and after your code, all the formatting will be preserved and it will be much easier for everyone to read. I took the liberty of adding that for you.

Is your code indented correctly here on the forum? Your return statement is too deep, it should be at the same level as the first for.

Also, do not run queries in the configureEditor or configureCell functions. They run on the event dispatch thread, so any slowdown from your query will lead to terrible client performance. Use a custom property to bring in the values from that named query, and simply reference it in the extension function - that way the query is automatically run asynchronously.

3 Likes

@PGriffith how do we reference a custom property in the configureEditor extension function please?

thanks Hazey

Depends on where the custom property is at.

If the custom property is on the Power Table Component then:

self.customPropertyName

If the custom property is on the parent of the Power Table Component then:

self.parent.customPropertyName

Honestly though, just use the property selector in the top right corner of the component scripting dialog to choose the property that you want, it will take care of building the correct reference path for you.

1 Like

Irose thanks, but I do not have those selectors on right hand side, version 8.1.10?

OK I see it is .13 it was added:)