rubanraj54 / vue-bootstrap4-table

Advanced table based on Vue 2 and Bootstrap 4 ⚡️
MIT License
219 stars 57 forks source link

Id not being passed to on-select-row payload #32

Closed tettoffensive closed 5 years ago

tettoffensive commented 5 years ago

For background, I am using "vue-bootstrap4-table": "^1.1.2" to display elements in my firebase firestore database. I am using a package called "vuefire": "^2.0.0-alpha.20".

This gives me an array of objects which have 3 properties image_url,subtitle,title, along with an id.

When I do my own v-for loop I am able to access all the properties as well as the id. But for some reason the id is missing from the payload in my @on-select-row handler. In addition even though I added a column for id. Those rows are blank.

{
          label: 'Identifier',
          name: 'id',
          sort: false,
          row_text_alignment: 'text-left',
          column_text_alignment: 'text-left',
          uniqueId: 'true',
        },

Looking at the console, I'm wondering if it's because there are no "getters" for id? Do you think this is why? Or maybe you have a better idea?

From the chrome console:

> books
(3) [{…}, {…}, {…}, __ob__: Observer]
0:
image_url: (...)
subtitle: (...)
title: (...)
id: "7KS7KdJ9kqd1GLN3ewm2"
__ob__: Observer {value: {…}, dep: Dep, vmCount: 0}
get image_url: ƒ reactiveGetter()
set image_url: ƒ reactiveSetter(newVal)
get subtitle: ƒ reactiveGetter()
set subtitle: ƒ reactiveSetter(newVal)
get title: ƒ reactiveGetter()
set title: ƒ reactiveSetter(newVal)
__proto__: Object
1:
image_url: (...)
subtitle: (...)
title: (...)
id: "Jvsw6GUXJrzOgapzkYCQ"
__ob__: Observer {value: {…}, dep: Dep, vmCount: 0}
get image_url: ƒ reactiveGetter()
set image_url: ƒ reactiveSetter(newVal)
get subtitle: ƒ reactiveGetter()
set subtitle: ƒ reactiveSetter(newVal)
get title: ƒ reactiveGetter()
set title: ƒ reactiveSetter(newVal)
__proto__: Object
rubanraj54 commented 5 years ago

It is really strange. Could you please make a codepen example to debug more? But in your console message, I can see the 'id' field.

I've made a codepen example for you, and I can access id from the selected row. And you don't really need to have the id column in the table.

https://codepen.io/rubanraj54/pen/qvQPRe

Screenshot from 2019-03-21 17-57-03

Cheers, Ruby.

rubanraj54 commented 5 years ago

Closing this issue since there is no activity for more than 10 days.