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.

2 Likes