ratiw / vue-table

data table simplify! -- vuetable is a Vue.js component that will automatically request (JSON) data from the server and display them nicely in html table with swappable/extensible pagination component.
MIT License
1.83k stars 303 forks source link

Expand detail-row for all rows #140

Closed ivlevdenis closed 7 years ago

ivlevdenis commented 7 years ago

How to?

ratiw commented 7 years ago

@ivlevdenis

<vuetable v-ref="vuetable"
  ...
></vuetable>
new Vue({
  //...
  //...
  methods: {
    expandAllDetailRows: function() {
      this.$refs.vuetable.visibleDetailRows = this.$refs.vuetable.tableData.map(function(item) {
        return item.id
      })
    }
    collapseAllDetailRows: function() {
      this.$refs.vuetable.visibleDetailRows = []
    }
  }
})
ivlevdenis commented 7 years ago

Hmmmm... Excellent! ps: Please, add this to detail-row doc.

TurboControl commented 5 years ago

Please note that item.id is really item[this.$refs.vuetable.trackBy] if your data is not 'id' based.