The project uses backbone + underscore and jade + stylus.
There is a variable in the jade template that displays an unsorted list.
<% _.each(territory_list, function(territory) {%> To display the list, use the _.each method.
If I understand correctly, to display a sorted list, it is necessary to use the _.sortBy method for the territory_list displayed list. But I do not understand where this method is applied. Imagine that the record should be something like this (does not work):
<% _.each_.sortBy(territory_list, function(territory) {%> How to display a sorted list using the method from underscore?
UPD
I clarify the question. As a result of sorting the list should be displayed in ascending order. For example:
Территория 1 Территория 2 Территория 3 ... Территория 20 etc.
_.sortByassumes sorting by some parameter (or using an iterator function). Hence the question: what are theterritory_listelements and what is the logic of their sorting. - Dmitriy Simushevterritory_listis - as I wrote in the question - a list, i.e.<ul><li></li></ul>... - Marina VoronovaТерритория 1- Marina Voronovaterritory_listelements are strings with html, then no1and20anymore. - Dmitriy Simushev