[Vuejs]-How do I get to open only one detail in b-table?

0πŸ‘

βœ…

I don’t have the custom component code such as b-table, but what you would like to do is the following

https://vuetifyjs.com/en/components/data-tables/#expandable-rows

  1. Basically a separate array tracking which rows are currently open.
  2. Assuming b-table extends v-data-table, pass through the :expanded property and add the tracking array.
  3. On details open, set the array to [], which should close everything.
  4. And immediately afterwards, set the index of the row you want to open to 1.

See the above Vuetify link for an example of how they do it, make sure to toggle the "Single Expand" option.

Leave a comment