Remove any old category filters when setting a new one.
authorMike Taylor <mike@indexdata.com>
Thu, 24 Apr 2014 11:45:11 +0000 (12:45 +0100)
committerMike Taylor <mike@indexdata.com>
Thu, 24 Apr 2014 11:45:11 +0000 (12:45 +0100)
The special empty category-id means not to use a filter at all.

src/mkws-team.js

index 8d33d9e..b02b441 100644 (file)
@@ -185,7 +185,9 @@ function team($, teamName) {
 
     that.limitCategory = function(id) {
        log("limitCategory(id=" + id + ")");
-       m_filterSet.add(categoryFilter(id));
+        // Only one category filter at a time
+       m_filterSet.removeMatching(function(f) { return f.type === 'category' });        
+        if (id !== '') m_filterSet.add(categoryFilter(id));
         if (m_query) triggerSearch();
        return false;
     };