Forum

VUE/JS - sorting co...
 
Notifications
Clear all

VUE/JS - sorting collection of objects (array problem)

1 Posty
1 Users
0 Reactions
456 Widok
0
Topic starter

how to sort VUE / JS attribute that contains list of object insted of array

1 Answer
0
Topic starter

example code (sorting districts by demand for industry object)

  industry.districts = Object.values(industry.districts);
  industry.districts.sort((a, b) =>
    a.demand < b.demand ? 1 : b.demand < a.demand ? -1 : 0
  );

 

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: