I have an app in backbone and underscore.
I have already seen this questions but I haven'0t solved my problem because is a little bit different:
Sorting Backbone Collections
Backbone/Underscore sortBy is not sorting collection
My problem is: I have a collection into a view and I want to sort it by the field order and after print this collection into the template.
I have tried this but doesn't work with underscore:
this.hotels.models = _(this.hotels.models).sortBy("order");
$(this.el).html(this.template({hotels: this.hotels.models}));
How can I sort my collection(model) and after print it inot template? My code doesn't sort my array.