Method "find" didn't work properly for me when I tried to write my own
code based on "Google maps jQuery plugin 3.0-rc1 filter
by property" example. Here is my attempt to fix the problem:
find: function(ctx, options, callback) {
var obj = this.get(ctx);
options.value = $.isArray(options.value) ? options.value : [options.value];
for ( var property in obj ) {
// Correct search in marker properties. We are looking for options.property.
if ( obj[property].hasOwnProperty(options.property) ) {
// We always need an array for inArray method.
obj[property][options.property] = $.isArray(obj[property][options.property]) ? obj[property][options.property] : [obj[property][options.property]];
var isFound = false;
for ( var value in options.value ) {
// the second argument must be an array.
if ( $.inArray(options.value[value], obj[property][options.property]) > -1 ) {
isFound = true;
} else {
if ( options.operator && options.operator === 'AND' ) {
isFound = false;
break;
}
}
}
callback(obj[property], isFound);
}
}
return this;
Original issue reported on code.google.com by xyxyxyxy...@gmail.com on 25 Nov 2012 at 5:43
Original issue reported on code.google.com by
xyxyxyxy...@gmail.com
on 25 Nov 2012 at 5:43