[Vuejs]-Change colour on b-table detailed view

0👍

You can get around it by styling the element manually, but you have to style one of their “internal” elements (as opposed to the b-table component). I would call that a bug. Open an issue on their GitHub page.

const data = [{"id": 1,"user": {"first_name": "Jesse","last_name": "Simmons"},"date": "2016/10/15 13:43:27","gender": "Male"}];


new Vue({
  el: '#app',
  data() {
    return {
      data,
      defaultOpenedDetails: [1]
    }
  },
  methods: {
    toggle(row) {
      this.$refs.table.toggleDetails(row)
    }
  }
});
.inner-table .table { background: gold; }
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script src="https://unpkg.com/buefy/dist/buefy.min.js"></script>
<link href="https://cdn.materialdesignicons.com/2.0.46/css/materialdesignicons.min.css" rel="stylesheet" />
<link href="https://unpkg.com/buefy/dist/buefy.min.css" rel="stylesheet" />


<div id="app" class="container">

  <b-table :data="data" :opened-detailed="defaultOpenedDetails" detailed detail-key="id" :show-detail-icon="true">

    <template slot-scope="props">
      <b-table-column field="id" label="ID" width="40" numeric>{{ props.row.id }}</b-table-column>
      <b-table-column field="user.first_name" label="First Name">{{ props.row.user.first_name }}</b-table-column>
      <b-table-column field="user.last_name" label="Last Name">{{ props.row.user.last_name }}</b-table-column>
    </template>

    <template slot="detail" slot-scope="props">
      <b-table :data="data" class="inner-table">
        <template slot-scope="props">
          <b-table-column field="id" label="ID" width="40" numeric>{{ props.row.id }}</b-table-column>
          <b-table-column field="user.first_name" label="First Name">{{ props.row.user.first_name }}</b-table-column>
          <b-table-column field="user.last_name" label="Last Name">{{ props.row.user.last_name }}</b-table-column>
        </template>

        <template slot="detail" slot-scope="props">
          FOO
        </template>
      </b-table>
    </template>
  </b-table>
</div>

(based on https://buefy.org/documentation/table/ CodePen link for “Detailed row”)

Leave a comment