for (var i = 1; i <= news.length; i++) {
var newsData = news.get(i);
var newsRow = JST["news/row"](newsData.attributes);
$("#news_tbody").prepend(newsRow).children('tr').addClass(function(){
if (newsData.get('is_read') == 1)
{return "news_read";}
else if (newsData.get('is_read') == 0)
{return "news_unread";}
});
В этом случае я хочу загрузить только строки, где newsData.get('_type') == "friends"
. Интересно, как правильно его указать.
_.each(news.where({ '_type': 'friends' }), function (item) {
var newsRow = JST['news/row'](item.toJSON());
$('#news_tbody').prepend(newsRow).children('tr').addClass(function () {
return item.get('is_read') ? 'news_read' : 'news_unread';
});
});
Backbone.Collection
.