# Table Dropdown that I can type into

**URL:** <https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733>\
**Category:** Ignition\
**Tags:** vision, scripting\
**Created:** [September 17, 2025, 8:00pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733 "2025-09-17T20:00:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MindMusic](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@MindMusic](https://forum.inductiveautomation.com/u/MindMusic)\
**Post date:** [September 17, 2025, 8:00pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733/1 "2025-09-17T20:00:43Z")

</div>

Hey there everyone,  
I’m trying to create a table cell where I can select from existing similar values in a dropdown, or type new values into it like a regular table cell or text box… the following code on my PowerTable gets me very close…

```java
def configureEditor(self, colIndex, colName):
    
    if colName == 'SubProject':
    
        ProjectID = self.parent.ProjectID
        
        from javax.swing import AbstractCellEditor, JComboBox
        from javax.swing.table import TableCellEditor
        
        class MyCellEditor(TableCellEditor, AbstractCellEditor):
            def __init__ (self, tableComponent):
                self.table = tableComponent
                self.cbValues = None
                
            def getTableCellEditorComponent(self, table, value, isSelected, rowIndex, vColIndex):
                # Get a list of other values existing values
                newData = system.db.runPrepQuery("SELECT DISTINCT C.[SubProject] FROM OMS.[Categories] AS C INNER JOIN CRM.[Milestones] AS M ON M.[ID] = C.[MilestoneID] WHERE M.[ProjectID] = ? ORDER BY C.[SubProject]", [ProjectID])
                newList = []
                
                for row in newData:
                    newList.append(row[colName])
                
                # Build the Combo box with the values from above
                self.cbValues = JComboBox(newList)
                
                # Make the combo box editable
                self.cbValues.setEditable(1)
                
                # Ensure that the existing value is selected.
                self.cbValues.setSelectedItem(value)
    
                return self.cbValues
            
            def getCellEditorValue(self):    
                return self.cbValues.getSelectedItem()
        
        return {'editor': MyCellEditor(self)}

```

The only drawback is that after I type a new value into it and press enter, it doesn’t stop editing and lose focus… I have to know to click on something else on the screen in order for the value I entered to “stick” by calling the powertable’s onCellEdited event.

Does anyone know how to make the typed editing behave more like a regular text box, where pressing enter commits the edit? Thanks in advance!

Frank. 🙂

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [September 17, 2025, 8:52pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733/2 "2025-09-17T20:52:06Z")

</div>

I did this with a standard drop down list and a data entry box with an indirect binding to the index of dropdown

---

<div class="post-metadata">

**Author:** ![MindMusic](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@MindMusic](https://forum.inductiveautomation.com/u/MindMusic)\
**Post date:** [September 18, 2025, 12:17pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733/3 "2025-09-18T12:17:32Z")

</div>

Yeah, I would do that too if it were a single dropdown box…except I need this in a table. ☹

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [September 18, 2025, 12:33pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733/4 "2025-09-18T12:33:45Z")

</div>

Ah, sorry, I misunderstood the need. Just one column of the table?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [September 18, 2025, 4:10pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733/5 "2025-09-18T16:10:17Z")

</div>

Almost always, if a dataset/table needs to be interacted with I just end up making a template that is a single row and then use a template repeater to fill in the row’s parameter. You could easily use a dropdown component in the “row template.”

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [September 18, 2025, 5:34pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733/6 "2025-09-18T17:34:01Z")

</div>

You are very close. You need to make your class be an action listener, so that you can react to the combo box's action. Specifically, when you press the enter key, then the action command will be comboBoxEdited. So if you look for that, then you can stop the editing when the enter key is pressed.

```python
def configureEditor(self, colIndex, colName):
    
    if colName == 'SubProject':
    
        ProjectID = self.parent.ProjectID
        
        from javax.swing import AbstractCellEditor, JComboBox
        from javax.swing.table import TableCellEditor
        from java.awt.event import ActionListener

        class MyCellEditor(TableCellEditor, AbstractCellEditor, ActionListener):
            def __init__ (self, tableComponent):
                self.table = tableComponent
                self.cbValues = None
                
            def getTableCellEditorComponent(self, table, value, isSelected, rowIndex, vColIndex):
                # Get a list of other values existing values
                newData = system.db.runPrepQuery("SELECT DISTINCT C.[SubProject] FROM OMS.[Categories] AS C INNER JOIN CRM.[Milestones] AS M ON M.[ID] = C.[MilestoneID] WHERE M.[ProjectID] = ? ORDER BY C.[SubProject]", [ProjectID])
                newList = []
                
                for row in newData:
                    newList.append(row[colName])
                
                # Build the Combo box with the values from above
                self.cbValues = JComboBox(newList)
                
                # Register this class as an action listener on the combo box
                self.cbValues.addActionListener(self)

                # Make the combo box editable
                self.cbValues.setEditable(1)
                
                # Ensure that the existing value is selected.
                self.cbValues.setSelectedItem(value)
    
                return self.cbValues
            
            def getCellEditorValue(self):    
                return self.cbValues.getSelectedItem()

            def actionPerformed(self,actionEvent):
                if actionEvent.getActionCommand() == 'comboBoxEdited':
                    self.stopCellEditing()
      
        return {'editor': MyCellEditor(self)}

```

---

<div class="post-metadata">

**Author:** ![MindMusic](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@MindMusic](https://forum.inductiveautomation.com/u/MindMusic)\
**Post date:** [September 18, 2025, 7:14pm UTC](https://forum.inductiveautomation.com/t/table-dropdown-that-i-can-type-into/110733/7 "2025-09-18T19:14:27Z")

</div>

I suspected it was something like this, but couldn’t suss out the exact syntax to use. Thanks so much! 🤎
