> hi ross, i understand the array how its work....and now its removing
> value from array as well.....but i think i m calling it in wrong
> place. becoz its removing wrong markers....
No, your doing it in the right place, and I believe its removing some
of the right markers, BUT it's not removing all the ones you expect.
My fault for suggesting this structure -
> for(id in batch){
>...
> if (...
> } else { ...
> batch.splice(id,1);
> }
> }
It's really dumb to delete items from an array while we're stepping
through it, it messes up the for-in loop.
Try this workaround
var for_deletion = []; // a temporary store
for(id in batch){
...
if (...
} else { ...
map.removeOverlay(....
for_deletion.push(id); // make a note for later
deletion
}
} // end of for-in loop
for (var i = 0; i < for_deletion.length; i++) { // scan for the
ones we need to bin
{
id = for_deletion[i];
batch.splice(id,1); // really delete the item
}
There's probably a much more elegant way to do this!
cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---