S
S
siteohio2020-04-25 10:38:34
JavaScript
siteohio, 2020-04-25 10:38:34

How to sort the finished table?

Good afternoon!
There is a ready table .
You need to sort its fields depending on age, that is, the greater the age, the lower the line and vice versa.
But the problem is that there is a field to add, that is, after adding a new field, everything should also be sorted.

Question. How to implement it? Are there paid or free plugins?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-04-25
@siteohio

Change the loop to v-for="(person, index) in sortedPersonsand add computeda section

computed: {
  sortedPersons: function () {
    return [...this.persons].sort((a, b) => a.age - b.age);
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question