[OpenLayers-Users] Understanding events
Stephen Woodbridge
woodbri at swoodbridge.com
Tue Dec 8 16:37:56 EST 2009
Yves Moisan wrote:
>> I thought
>>
>> MyMap.events.register("loadend", layers[0], selectFeature(layers[0],oFeatures[0].fid));
>>
>
> I at least learned that a loadend is only registerable on a layer, so :
>
> layers[0].events.register("loadend", layers[0],
> selectFeature(layers[0],oFeatures[0].fid));
>
> It still does not show anything though. However, just to test that I
> did get a loadend event, I tried :
>
> layers[0].events.register("loadend", layers[0], function()
> {alert("Highlight on"); });
>
> And I got the alert, so it means the loadend event is triggered. Why my
> function call does not work is beyond me.
Try calling your select function using a timer delay from loadend event.
I have found that sometimes events fire but the thread adding stuff to
the DOM or something like that has not completed yet and adding a
30-50ms delay before calling my code solved the problem.
Yeah, I know it ugly, but give it a try and see if it helps.
-Steve W
More information about the Users
mailing list