[OpenLayers-Users] triggering an SelectFeature's onSelect event

Eric Lemoine eric.c2c at gmail.com
Wed Mar 12 14:13:48 EDT 2008


Xin, onSelect is a simple callback func called when a feature is
selected, it's not called as part of OL event framework. To call
manually you can do ctrl.onSelect(feature). On a side note, note that
trunk now has real events triggered when features are selected. See
API doc and examples in trunk. Cheers,

2008/3/12, Xin <xin at zenpow.com>:
> Hi,
>
> I have an KML layer which when a feature is clicked, a pop up opens. This is
> working now. Thanks!
>
> selectControl = new OpenLayers.Control.SelectFeature( kmlLayer,
>                          { onSelect: onFeatureSelect,
>                            onUnselect: onFeatureUnselect
>                           });
>
> I would like to trigger the onSelect 'event' (is it an event?) manually. I
> tried doing the following with map.events.triggerEvent without success.
>
> map.events.triggerEvent('clickevent', kmlLayer.features[0])
>
> Can anyone help at all?
>
> Xin
>



More information about the Users mailing list