Skip to content Skip to sidebar Skip to footer

Backbone Collection Is _.groupedby But Not Render Doesn't Work

I am struggling with my _.groupBy function. With this code I have rendered in the browser something like this: align spellcheck isContentEditable contentEditable Item 1 Item 1 Item

Solution 1:

I haven't read through all of your code, so I can't speak to any other problems, but I can immediately see a problem with your groupBy function. If you use App.Collections.Items, you're not going to be passing the collection instantiated in the view to the function; you're going to be passing the empty Collection constructor object to the function! Also, you need to turn the collection into JSON. What you want is something more like this:

var groups = _.groupBy(this.collection.toJSON(), 'category');

Post a Comment for "Backbone Collection Is _.groupedby But Not Render Doesn't Work"