Hi all, I am currently trying to open a popup from a table. It is configured to open onRowClick, when a user clicks onto the table itself. I am a bit stuck on how to pass the data inside the table cell onto the popup (as a parameter) if it is even possible.
The only thought I have is passing {/root/Table/props.data} but this wouldn’t work as it would force the entire table data inside. I can find the cell position through the selectedRow, but not sure how to point at the data at this position.
You should make sure you’re using a Script Action to open the Popup. If you do this, the script has an event object available which contains information about the row which was clicked:
def runAction(self, event):
"""
Fired when a row in the table is clicked.
Arguments:
self: A reference to the component that is invoking this function.
event: An object with the following attributes:
row (int): The unique row index as it is represented in the source
data. Also known as the row ID.
rowIndex (int): The row index as it is represented in the current
visible data.
value (dict): The row's value as a JSON object.
"""
If event.row or event.rowIndex don’t work for what you need becuase your value is part of the row’s data, then you would need to reference it a la event.value["<relevant_column_name_here>"].
Example:
Hi there,
I’ve had trouble passing in the parameter - I’ve tested the code and the right value is being read from the table row, just not sure why it is not getting input as a parameter: the following is my code :
I’ve also output the parameter itself to a label and can confirm its showing up as the correct value for the event.value[“parameter”]. It seems to just not be going in as a parameter for the popup. I’ve also put a label on the popup to show the parameter, of which it is the default value. Any advice?
Hi cmallonee,
I found my mistake - I wasn’t actually passing the parameter through because of some grammar issues - this caused the wrong input to be pushed through. A good lesson to double check any written code. Cheers