vue.jsbulmabuefy

buefy table get data of clicked row


Below is my code:

<b-table :data="sortTeachersAndPoints(topTeachers)" :columns="topTeachersColumns" :mobile-cards="false" @click="clickTeacher(data)"></b-table>

Everything above works good except the clickTeacher(data) part. What I'm trying to do is pass the selected row's data to clickTeacher but (understandably), I got this error Property or method "data" is not defined on the instance when clicking any row.

So actually what should I write to pass the selected row's data to clickTeacher?


Solution

  • use your clickTeacher and pass the $event

     <b-table :data="sortTeachersAndPoints(topTeachers)" :columns="topTeachersColumns" :mobile-cards="false" @click="clickTeacher($event)" ></b-table>