changed itemcollection to support filtering by traits

This commit is contained in:
Edin Dazdarevic
2015-02-11 07:11:28 +01:00
parent 108f370bd0
commit 3986ac340c
4 changed files with 38 additions and 13 deletions

View File

@@ -51,13 +51,19 @@ var fetchItemWithDetails = function() {
}
}
var fetchItemsByCategory = function(categoryId) {
var fetchItemsByCategory = function(categoryId, query) {
var items = _itemsByCategory;
items.setClassificationType(2);
items.setClassificationId(categoryId);
items.setLimit(30);
items.setOffset(0);
for(var key in query) {
if (query.hasOwnProperty(key)) {
items.addFilter(key, query[key]);
}
}
items.fetch({
success: function() {
ItemStore.emitChange();
@@ -140,7 +146,7 @@ AppDispatcher.register(function(payload) {
loadItemsForFrontpage();
break;
case ItemConstants.LOAD_BY_CATEGORY:
fetchItemsByCategory(action.categoryId);
fetchItemsByCategory(action.categoryId, action.query);
break;
default: