0

製品ごとにフィルタされたアイテムのグループを作成するにはどうすればよいですか? または、カテゴリからのデータでアイテムをフィルタリングするにはどうすればよいですか?

var Categories = new Backbone.Collection();

Categories.add([
  { title: 'category 1', category_type: 'category 1' },
  { title: 'category 2', category_type: 'category 1' },
]);

var Items = new Backbone.Collection();

Items.add([
  { title: 'Product 1', category: 'category 1' },
  { title: 'Product 2', category: 'category 1' },
  { title: 'Product 3', category: 'category 2' }
]);


var byFiltred = Items.groupBy('category');

var filtred = new Backbone.Collection(byFiltred['category 1']);

console.log(filtred.pluck('title'));

ご意見、ご回答ありがとうございます!! マクロマット

4

2 に答える 2