Accessing data from a dropdown menu instantiated as an embedded view in a table

I have a table with three columns, the first two hold identifier values and the third holds a dropdown menu instantiated automatically for each entry. The data for the first two columns is read from a database.

Currently the dropdown menus are identified when selected and the database is queried using the getSelectedIndex function of the table to get data into the dropdowns.

How should I go about supplying the other table data to the dropdowns when they are initiated rather than waiting for a user to select a data row?

Where you create the dropdown? Why do you not fill it up immediately?

1 Like

The dropdown is created as an embedded view by calling the view path in the columns section of the table properties and I am unable to create them on a entry-by-entry basis.

So, you could give parameters aswell to the view which then fills up the dropdown?

1 Like

Yes, I am trying to send parameters through the view, but the parameters need to be from the same row in the other columns and I can only retrieve them from the the database after all the components are already created, by finding the correct row value that the dropdown is in using selectedRow

heh i see.
could you show me how you are filling them up right now?

1 Like

Right now they are filled with a static list that’s hardcoded into the dropdown. I also have a changeScript that reads the chosen dropdown item and then pulls new parameters to use from the selected row.

Thank you for your help, I appreciate it

could you show me that changescript?^^

1 Like

def valueChanged(self, previousValue, currentValue, origin, missedEvents):
“”"
This function will be called when the value of the property changes.

Arguments:
	self: A reference to the component that is invoking this function.
	previousValue: The previous value, as a qualified value object.
	currentValue: The new value, as a qualified value object.
	origin: The origin of the property value. Possible origin values include
	        Browser, Binding, BindingWriteback, Script, Delegate, Session, Project
	missedEvents: A flag indicating that some events have been skipped due
	              to event overflow.
"""

id = self.view.params.id
colName = self.view.params.colName

if id != "NoId":
	if colName != "NoId":
		update = "UPDATE destination SET chuteID = ? WHERE " + colName + " = ? "
		p = [self.props.value,id]
		r = system.db.runPrepUpdate(update,p)

You are writing down the dropdowns options in the database when they click a row?

Thats not neccecary!
in your view with the dropdown you can add the params (or just the ones you need):

column
columnIndex
row
rowIndex
value
rowData

These will get automattically filled in to each row correctly, no need to bind it in the viewParams either!

Here i just use a textfield and label but you see what i mean?^^


(viewpaths name is just ‘text’ xd made a quick example)
image

image
image

image

1 Like

Thank you so much!