q-table, can I detect a row click?

  • I don’t want selection per se, just to know when user clicks on a row

    How would I do that? I want to update a detail table based on an id in the row

    I assume I could create a template for #body slot and put my logic there, but was wondering if there was a simple “onRowClick” lurking somewhere


  • BTW, row slot seems to work ok, but if anyone knows a simpler way, do tell

    <template class=“row” #body=“props”>
    <q-tr :props=“props” @@click.native=“requestRowClick(props.row.id)” class=“cursor-pointer”>
    <q-td v-for=“col in props.cols” :key=“col.name” :props=“props”>
    {{ col.value }}

  • Trouble with above solution is that it ignores my existing #body-cell-[name] slots

    Any way to “derive” q-tds instead of simply iterating on props.cols?

  • Also, if I were to use selection=“single”, any way to make it select on row click, i.e. not demand click on checkbox ?

Log in to reply