Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Backbone render a collection in reverse order?

I'm using a Signalr hub to subscribe to events on the server. What an event is dispatched to a hub, its successfully adding the item to a Marionette CollectionView. This, in turn, is rendered to a table.

Because the table of events is essentially a blotter, I'd like the events in reverse order and preferably only keep n-number of events.

Can Backbone 'automatically' re-render a collection in reverse order?

like image 931
Joe Avatar asked Mar 19 '12 12:03

Joe


1 Answers

To go through collection in the reverse order I usually use a construction like this:

_.each(collection.last(collection.length).reverse(), function(model){ });
like image 130
JuliaCesar Avatar answered Sep 30 '22 15:09

JuliaCesar