NIHVIVO-725 Fixing error in previous commit: Define acFilter before the sparql query, so in case the latter fails we don't get an error later when referencing the filter.

This commit is contained in:
rjy7 2010-07-13 14:17:01 +00:00
parent 1a14ffba90
commit cddda3087a

View file

@ -194,15 +194,18 @@ var customForm = {
var key = data.head.vars[0]; var key = data.head.vars[0];
$.each(data.results.bindings, function() { $.each(data.results.bindings, function() {
this.acFilter.push(this[key].value); customForm.acFilter.push(this[key].value);
}); });
}, },
filterAcResults: function(results) { filterAcResults: function(results) {
var filteredResults = []; var filteredResults;
if (!this.acFilter.length) { if (!this.acFilter.length) {
return results; return results;
} }
filteredResults = [];
$.each(results, function() { $.each(results, function() {
if ($.inArray(this.uri, customForm.acFilter) == -1) { if ($.inArray(this.uri, customForm.acFilter) == -1) {
// console.log("adding " + this.label + " to filtered results"); // console.log("adding " + this.label + " to filtered results");