Dropdown Table: Row Selection Problems

Hi, I have a problem returning the user selection of a row in a dropdown table.

I am passing production routing details to string array tags from our ERP system, as the length of each routing will vary every time. The arrays are then passed to a dropdown table as 6 columns, via script, which works perfectly.

The problem occurs now for me. I need the operator to select the Operation they are working on to proceed. If I double click on my selected row in the dropdown the dropdown table collapses but the view only shows the selected first column, not the entire row selection.

I can return the row index via script, but the row string is only the first column (sequence 0000), as shown.

The first problem is how do I show the operator the entire row they selected, not just the first column?
The second problem is even after selecting the appropriate row nothing is returned until the dropdown is clicked once more, even when placing the script in mouseReleased or properyChange events.

I can pull the row as a string by script, but it does not make a nice UI for the operator of they just see the "000000" after selection.
Any help would be appreciated.

Sounds like the dropdown component is the wrong component for the job. Consider using the selection mode on an read-only table component for something like this.

1 Like

Playing around with this idea, I was able to accomplish this by overlaying a label with the fill background property set to True:

Here is the result:

Here is the script that drives the overlay text:

# Written for the property change event handler of the dropdown component
# Qualify the event script using the property name of the selected index
if event.propertyName == 'selectedIndex':
	# get the overlay label component named 'OverlayLabel'
	overlayLabel = event.source.parent.getComponent('OverlayLabel')
	# get the dropdown component
	dropdown = event.source
	# define the selectedRow as the new selectedIndex
	# This requires columns zero or one to be unique
	selectedRow = event.newValue
	# if nothing is selected, apply the dropdown's noSelection text to the overlay's text
	if selectedRow == -1:
		overlayLabel.text = dropdown.noSelectionString
	# if something is selected, create a comma delimited string out of the selected row, and display it in the overlay label
		# Create a list of each element in the selected row ignoring the hidden value row (index zero)
		# Make sure each element is a string datatype for concatenation for the overlay label's text property
		rowData = [unicode(dropdown.data.getValueAt(selectedRow, column)) for column in range(1, dropdown.data.columnCount)]
		# Concatenate the selectedRow list elements with commas between each element
		displayText = ', '.join(rowData)
	# Set the comma delimited string to the overlay component's text property
	overlayLabel.text = displayText

Simply position the label component where it completely covers the text field of the dropdown component.


I like this, very nice. I may revert back to this at some point!

Thank you. The functionality certainly seems to work better, although not what I had in mind visually. Small cost to make things easier though. Appreciate your reply.