Genie Discord forum
![Author Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
Is it possible to access the index of a row in a table, through the click event, as happens in the plot event ?
![Author Avatar](https://cdn.discordapp.com/avatars/743412727464067154/bc30abeb49653e9978c0f7c90f4486a8.png?size=512)
You'd have to use quasar's v-on:row-click
event. Here's how to
using GenieFramework
using DataFrames
@genietools
@app begin
@in id = 0
@in rowcontent = ""
@out data = DataTable(DataFrame(a = rand(5) , b = rand(5)))
@onchange id begin
@show id
end
@onchange rowcontent begin
@show rowcontent
end
end
function ui()
[
p("Row: {{id}}, {{rowcontent}}")
table(:data, var"v-on:row-click"="function(event,row) {id=row.__id;rowcontent=row}")
]
end
@page("/", ui)
up()
![Author Avatar](https://cdn.discordapp.com/avatars/743412727464067154/bc30abeb49653e9978c0f7c90f4486a8.png?size=512)
This defines an anonymous Javascript function that is executed when the click event is triggered. This event generates an event code and a row variable with the row contents, which we pass to the anonymous function.
![Author Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
@Pere It was incredible