How to get data from a Quasar table row with the event @row-click
·
Answer a question
How can the data associated with a row be obtained from a table with the @row-click event?
In the following example, how do I get the id and the name values of the clicked row?
<q-table
title="Treats"
dense
:data="data"
:columns="columns"
row-key="id"
@row-click="rowclick(evt, row)"
/>
(...)
methods: {
rowclick(evt, row){
alert()
}
},
Answers
Try this @row-click="onRowClick".
<q-table
title="Treats"
dense
:data="data"
:columns="columns"
row-key="id"
@row-click="onRowClick"
/>
methods: {
onRowClick (evt, row) {
console.log('clicked on', row)
}
},
Codepen: https://codepen.io/Pratik__007/pen/qBdaeGY
更多推荐




所有评论(0)