Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
How to give a link to each row in bootstrap-vue table

I have an bootstrap-vue table in my project. I want to give each row a link (something like code below)

<template #row>
 <div @click="goToPage">
    {{ item.name}}
 </div>
</template>

but do not know how to access table tr in bootstrap codesandbox

i would really appreaciate if someone can help me with it

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can add selectable to your table and event row-selected:

<b-table select-mode="single" ref="selectableTable" selectable @row-selected="onRowSelected" small :fields="fields" :items="items" responsive="sm">

and then create method:

methods: {
  onRowSelected(item) {
    console.log(item)
  }
}
about 4 years ago · Juan Pablo Isaza Report

0

You can use the @row-clicked event, which as the name suggests is triggered when a row is clicked.

The method is sent the item for the row which was clicked, so you can access any information from the item if needed. Along with the index and native click event.

new Vue({
  el:"#app",
  data: () => ({
    items: [
      { age: 40, first_name: 'Dickerson', last_name: 'Macdonald' },
      { age: 11, first_name: 'Larsen', last_name: 'Shaw' },
      { age: 89, first_name: 'Geneva', last_name: 'Wilson' },
      { age: 38, first_name: 'Jami', last_name: 'Carney' }
    ]
  }),
  methods: {
    onRowClicked(item, index, event) {
      console.log(item)
    }
  }
});
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap@4.5.3/dist/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap-vue@2.21.2/dist/bootstrap-vue.css" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.12/vue.min.js"></script>
<script src="https://unpkg.com/bootstrap-vue@2.21.2/dist/bootstrap-vue.js"></script>


<div id="app" class="p-3">
  <b-table striped hover :items="items" @row-clicked="onRowClicked"></b-table>
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!