且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

骨干网收集_.groupedBy但不渲染不工作

更新时间:2023-09-26 21:27:10

我没有通过所有code的阅读,所以我不能给任何其他问题发言,但我马上就可以看到一个问题您GROUPBY功能。如果你使用App.Collections.Items,你不会是通过在视图中的函数实例化的集合;你会路过空集合构造对象的功能!另外,你需要把收集到JSON。你想要的是像这样的东西更多:

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');