bug fix filtering

This commit is contained in:
Edin Dazdarevic
2015-02-11 08:56:03 +01:00
parent 16ad65c3d7
commit 2ec8721920
3 changed files with 10 additions and 3 deletions

View File

@@ -40,8 +40,6 @@ var ByCategory = React.createClass({
var q = {};
NavigationActions.goToCategory(category, section, q);
var categoryId = this.getParams().id;
ItemActions.loadByCategory(categoryId, this.getQuery());
},
render: function() {
var self = this;
@@ -101,8 +99,9 @@ var ByCategory = React.createClass({
return filters;
},
componentWillReceiveProps: function() {
console.log("RECEIVING PROPS!!!!!!!!!!!!!!!!!!!!!!!!");
var categoryId = this.getParams().id;
ItemActions.loadByCategory(categoryId, this.getQuery());
ItemActions.loadByCategory(categoryId, FilterCriteriaStore.getAppliedCategoryFilters());
CategoryActions.loadCategoryDetails(categoryId);
},
componentDidMount: function() {
@@ -126,6 +125,10 @@ var ByCategory = React.createClass({
this.setState({
appliedCategoryFilters: FilterCriteriaStore.getAppliedCategoryFilters()
});
var categoryId = this.getParams().id;
//ItemActions.loadByCategory(categoryId, FilterCriteriaStore.getAppliedCategoryFilters());
//CategoryActions.loadCategoryDetails(categoryId);
}
},
_onChange: function() {

View File

@@ -8,6 +8,9 @@ var ItemCollection = Backbone.Collection.extend({
this.filters = this.filters || {};
this.filters[name] = value;
},
clearFilter: function() {
this.filters = [];
},
setLimit: function(limit) {
this.queryLimit = limit;
},

View File

@@ -53,6 +53,7 @@ var fetchItemWithDetails = function() {
var fetchItemsByCategory = function(categoryId, query) {
var items = _itemsByCategory;
items.clearFilter();
items.setClassificationType(2);
items.setClassificationId(categoryId);
items.setLimit(30);