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

Xin xin at zenpow.com
Thu Mar 13 12:24:02 EDT 2008


Thanks for the quick reply.

I would rather do it properly and use events. I couldn't anything in API
docs or examples. I had a look in feature-select and feature-select-popup.

Would you be able to point me to the right place?

I have tried using control.clickFeature(feature). It works when I call this
in Firebug console, but when called from a link (onclick), it gives me this
error:

this.multipleKey has no properties
this.select(feature);}}},multipleSelect:function(){return
this.multiple||this.ha...
line 815

I have posted this in dev

Xin

ps. Sorry to have emailed you direct before.


>
>
>
> On 12/03/2008, Eric Lemoine <eric.c2c at gmail.com> wrote:
> >
> > 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
> > >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080313/33cbbb3f/attachment.html


More information about the Users mailing list