From: Mike Taylor Date: Thu, 24 Apr 2014 11:45:11 +0000 (+0100) Subject: Remove any old category filters when setting a new one. X-Git-Tag: 1.0.0~851 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=00225202a26b07fdcccf237e9302eefe686ad2a5 Remove any old category filters when setting a new one. The special empty category-id means not to use a filter at all. --- diff --git a/src/mkws-team.js b/src/mkws-team.js index 8d33d9e..b02b441 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -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; };