question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use event row-clicked <b-table>.

See original GitHub issue

Hi guys, I’m trying to use event row-clicked to fill some props when click on a b-table row. Tried to find an example on google but without success. How can I use this event? I’m currently using a button for this, but I want to change it.

<b-table bordered striped hover :items="environments" :fields="fields" :current-page="currentPage" :per-page="perPage" :filter="filter"> <template slot="actions" scope="environment"> <b-btn size="sm" @click="log(environment.item)">Details</b-btn> </template> </b-table>

Is it possible use row-clicked or even double click for that? Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

84reactions
tmorehousecommented, Aug 8, 2017
<b-table bordered striped hover 
         :items="environments"
         :fields="fields"
         :current-page="currentPage"
         :per-page="perPage"
         :filter="filter"
         v-model="shownItems"
         @row-clicked="myRowClickHandler"
>
  <template slot="actions" scope="environment">
    <b-btn size="sm" @click="log(environment.item)">Details</b-btn>
  </template>
</b-table>
methods: {
  myRowClickHandler(record, index) {
    // 'record' will be the row data from items
    // `index` will be the visible row number (available in the v-model 'shownItems')
    log(record); // This will be the item data for the row
  }
}
12reactions
PierBovercommented, Jan 11, 2018

Strange that an example of using row-clicked isn’t in the docs…

https://bootstrap-vue.js.org/docs/components/table/

@tmorehouse would you accept a PR?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap Table row-clicked event - vue.js - Stack Overflow
The row-clicked event will pass 3 parameters to your function. The first being the item specific to the row that was clicked.
Read more >
Table | Components - BootstrapVue
<b-table> serializes the row data into strings for sorting and filtering, and circular references will cause stack overflows to occur and your app...
Read more >
Events - Bootstrap Table
jQuery Event: click-row.bs.table · Parameter: row, $element, field · Detail: It fires when the user clicks a row. The parameters contain: row :...
Read more >
[Part 3] Add and Remove Table Rows with Bootstrap Vue
Add a remove button for every row and define an event handler; Use the array filter function to filter out the element using...
Read more >
Bootstrap-Vue table - how to access the button clicked?
<button class="btn btn-dark" @click="update(data)" :ref="'btn' + data.index">Update</button>. 9. </template>. 10. </b-table>.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found