[OpenLayers-Users] triggering a featureselected event?

Christopher Schmidt crschmidt at metacarta.com
Tue Apr 28 11:53:18 EDT 2009


On Tue, Apr 28, 2009 at 11:42:39AM -0400, Chris Abraham wrote:
> Chris,
> Thanks for the quick reply.
> 
> I have actually already assigned this code to my featureselected and  
> featureunselected events for my markers.  The problem with just  
> running the code in the onFeatureSelect function is that it doesn't  
> close previously opened popups.  I was hoping that by explicitly  
> triggering the featureselected event it would implicitly trigger the  
> featureunselected event for the previously selected feature 

This is not true, though obviously you could trigger the events in
succession using the layer.selectedFeatures array. 

> and thus  
> close the existing popup before opening a new one.  Does that make  
> sense?  Do you have any advice on how to do this?

Nope, I have no clue how to do this, though layer.events.triggerEvent
might do it or something.

-- chris

> Chris
> 
> 
> On Apr 28, 2009, at 11:27 AM, Christopher Schmidt wrote:
> 
> > On Tue, Apr 28, 2009 at 11:20:42AM -0400, Chris Abraham wrote:
> >> Hi,
> >> I'm trying to make links on a page open the popups on features on a
> >> map.  I'm trying to accomplish this by triggering a featureselected
> >> event on the feature but I'm not sure how to do this.  I have a
> >> reference to the feature in my code.  Does anyone know how to trigger
> >> the event?
> >
> > I'm assuming you know that the featureselected event doesn't do  
> > anything
> > by itself... If you look at the code in:
> >
> >  http://docs.openlayers.org/library/overlays.html#displaying-popups
> >
> > Although it is based around selection/unselection, you can ignore the
> > 'evt', since you have the 'feature', that you need, and just take the
> > onFeatureSelect code and use it directly...
> >
> > Regards,
> > -- 
> > Christopher Schmidt
> > MetaCarta
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list