0

I'm trying to make <v-data-iterator> sortable, but I'm not sure how to connect it to <v-data-table> headers

Code

Here's a codepen https://codepen.io/anon/pen/vdrebY

Is there even way to do it? I don't necessarily need v-data-table, I just want to be able to sort v-data-iterator using v-data-table's header component (or any other component)

Community
  • 1
  • 1
Un1
  • 3,874
  • 12
  • 37
  • 79
  • I guess you can just sort `items` by arbitrary key value, no? – Traxo Feb 22 '18 at 10:38
  • @Traxo how would I do that? – Un1 Feb 22 '18 at 10:46
  • see [this question](https://stackoverflow.com/questions/979256/sorting-an-array-of-javascript-objects). Well there are multiple ways of what you could do... depends on the rest of the code... if you are making api calls then perhaps you can fetch already sorted array anyway. Currently your UI is messy(imo), and it seems to me that even you don't know what you want to do with it, so can't help you more than this. For example you can have `v-select` instead of table headers and then sort by it's value, wherein values are the keys of your objects. – Traxo Feb 22 '18 at 10:48
  • @Traxo Well, thanks for the tips, I'm gonna try and figure out how make it work – Un1 Feb 22 '18 at 10:54

0 Answers0