[OpenLayers-Dev] Map destructor - problem with controls
George.Muammar
george at muammar.net
Sun Aug 3 07:58:07 EDT 2008
Dear list,
While enhancing an application I found I had to modify Map.js. When it came
to destroying the controls something funny was happening.
I had 14 controls on the page. When it destroys the first (ie
this.controls[13]) , the next one disappears too. When it came to destroy
the next it would give an error.
I spent ages trying to understand what I had done wrong on my page
(comparing to previous version with smaller toolbar where the error did not
occur). Finally I gave up and added a try and catch as follows.
Sorry I am not a JS coder and have run out of time on this one...
(around line 541)
if (this.controls != null) {
for (var i = this.controls.length - 1; i>=0; --i) {
try {this.controls[i].destroy()};
catch (e) {};
}
this.controls = null;
}
George Mu'ammar
--
View this message in context: http://www.nabble.com/Map-destructor---problem-with-controls-tp18798019p18798019.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
More information about the Dev
mailing list