Skip to content

Commit

Permalink
Merge pull request #31 from 2trc/filterarray
Browse files Browse the repository at this point in the history
filters are grouped in an array instead of a dict
  • Loading branch information
biodiv committed Jan 4, 2018
2 parents 79f4c9d + acc8843 commit 956bad0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions anycluster/MapClusterer.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,11 @@ def constructFilterstring(self, filters):

filterstring = ''

for column in filters:
for filter in filters:

filterparams = filters[column]
column = list(filter.keys())[0]

filterparams = filter[column]

filterstring += ' AND ('

Expand Down
2 changes: 1 addition & 1 deletion anycluster/static/anycluster/anycluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Anycluster.prototype = {

this.baseURL = settings_.baseURL || "/anycluster/"
this.autostart = typeof(settings_.autostart) == "boolean" ? settings_.autostart : true;
this.filters = settings_.filters || {};
this.filters = settings_.filters || [];
this.center = settings_.center || [0,0];
this.clusterMethod = settings_.clusterMethod || "grid";
this.iconType = settings_.iconType || "exact";
Expand Down
14 changes: 7 additions & 7 deletions docs/filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ A filterObject looks like this:

.. code-block:: javascript
var filterObj = {
"db_column_name" : { "values": value, "operator": operator_string }
}
var filterObj = [
{"db_column_name" : { "values": value, "operator": operator_string }}
]
**value**
Expand All @@ -23,10 +23,10 @@ Example:

.. code-block:: javascript
var filters = {
"color": {"values" : "red", "operator":"!=" }
"number": {"values": [2,3], "operator": "either_="}
}
var filters = [
{"color": {"values" : "red", "operator":"!=" }},
{"number": {"values": [2,3], "operator": "either_="}}
]
anyclusterInstance.filter(filters);
Expand Down

0 comments on commit 956bad0

Please sign in to comment.