Merge pull request #440 from metamaps/feature/fix.fork.filter.bug

fix filter bug
This commit is contained in:
Connor Turland 2015-11-30 11:10:57 -05:00
commit 3b89a2a13f

View file

@ -3301,24 +3301,32 @@ Metamaps.Filter = {
// ['Topics', 'Synapses'] as 'collection' // ['Topics', 'Synapses'] as 'collection'
if (typeof collection === "object") { if (typeof collection === "object") {
Metamaps[collection[0]].each(function(model) { Metamaps[collection[0]].each(function(model) {
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; var prop = model.get(propertyToCheck);
if (prop && newList.indexOf(prop) === -1) { if (prop !== null) {
prop = prop.toString();
if (newList.indexOf(prop) === -1) {
newList.push(prop); newList.push(prop);
} }
}
}); });
Metamaps[collection[1]].each(function(model) { Metamaps[collection[1]].each(function(model) {
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; var prop = model.get(propertyToCheck);
if (prop && newList.indexOf(prop) === -1) { if (prop !== null) {
prop = prop.toString();
if (newList.indexOf(prop) === -1) {
newList.push(prop); newList.push(prop);
} }
}
}); });
} } else if (typeof collection === "string") {
else if (typeof collection === "string") {
Metamaps[collection].each(function(model) { Metamaps[collection].each(function(model) {
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; var prop = model.get(propertyToCheck);
if (prop && newList.indexOf(prop) === -1) { if (prop !== null) {
prop = prop.toString();
if (newList.indexOf(prop) === -1) {
newList.push(prop); newList.push(prop);
} }
}
}); });
} }