PowerTable ConfigureEditor doesnt seem to be firing

I have a powertable with a string column called “Shift”, and I have put the following code in the configureEditor function:

shifts = [(0, ‘AM Shift’), (1, ‘PM Shift’)]
print “1”
if ColName == ‘Shift’:
return {‘options’: shifts}

My goal is to provide a dropdown on the column for the user to select. I have tried many versions of this same idea that I have found on the forum, but no luck. If I click to edit the column, it presents the standard edit function for the table. I tried a print command to see if it is firing, but I it doesn’t output anything to the console.

I also have isCellEditable returing True

Has anyone else had issues using the ConfigureEditor function to display a dropdown?

Change “ColName” to “colName”

Good catch, I tried that, with the same result. To start from scratch, I dropped a new Power Table on the window, had it populate with “Test Data”. I then put the following in configureEditor and set isCellEditable to return True

if colName == ‘String Column’:
return {‘options’: [(0, ‘A Shift’), (1, ‘B Shift’), (2, ‘C Shift’)]}

Still, it just allows me to type in whatever I want in the the text box, without a dropdown.

In your first post you were checking for a column named ‘Shift’.

Did the name of the column change?

Good question. To start with a clean slate, I started over with a new powertable and used the “TestData” property to populate it with test data. The testdata includes a column called String Column.

You can put a print statement in there before returning the options.

That will narrow it down and tell you if the event is not being triggered or if there are problems with your return value.

I just restarted the designer and it started working! It wasn’t firing before, I tried the print solution earlier and it never fired. Now its firing just as it should, and I have a drop down now!

Thanks for your responses!

I have powertable with no bindings. I put data on the dataset editor. Then code in the configureEditor:

shifts = [(0, ‘AM Shift’), (1, ‘PM Shift’)]
print “1”
if colIndex == 1:
return {‘options’: shifts}

The drop down function works fine.

Next step: I use Postgres to create and populate a table with two varchar columns. Bind powertable data property to select sql table data.

Now it seems configureEditor is not firing at all.

I reset property bindings to no-bindigs but configureEditor still not working.

I will appreciate any help to understand what’s changing with the sql binding, or how to get a powertable sourced from a database working with a cell drop-down editor.

I had the same problem. I needed to dynamically make a cell editable/ non-ediatble. Also, the dropdown was to be displayed in the cell only when it is editable.

The issue was that the configureEditor function was not being called after the isCellEditable function. The way I solved it was to check the “editable” checkbox for the required column in the “Column Attributes Data” property of the Power Table. This makes all the rows of the column editable. Further, the isCellEditable function filters the cells that need to be non-editable. After this, the configureEditor function is called to populate the dropdown.

1 Like

See if this Topic helps. If you scroll down to the solution you can see two examples of drop down cells within Power Tables. One is defined and the other pulls its data from mysql table.