The on_action can be put on the table visual element. The index of the table can be extracted to show what you want.
In the code below, I click on a row.
The fruit on which I clicked will be displayed and a notification will be created.
from taipy.gui import Gui, notify
data = {"fruits":['apple', 'banana', 'apple', 'orange', 'banana', 'mango'],
"width":[12, 12, 31, 4, 8, 6],}
fruits_to_display = ''
md = """
<|{data}|table|on_action=do_something|>
<|{fruits_to_display}|>
"""
def do_something(state, var_name, action, payload):
idx = payload["index"]
state.fruits_to_display = data["fruits"][idx]
notify(state, "success", f'Clicked on fruit: {data["fruits"][idx]}')
Gui(md).run()
