Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have am using mouse events to add a new graphic as such.

paCounties.on("mouse-over", function (evt) {
  var highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol);
  map.graphics.add(highlightGraphic);
}

This works fine by showing my new graphic on mouse over. However, I had three other layers that had popups and now the popups don't work. If I comment out the above code and refresh my popups are back. So something with adding the graphics layer or mouse-over event is preventing the popups from working on my other feature layers.

How can I have a mouse over and still retain popups on other feature layers?

EDIT: As per John's suggestion I tried using selection symbol but I can't seem to get it to work on mouseover. I tried this:

I set my selection symbol on the feature layer.

paCounties.setSelectionSymbol(highlightSymbol);
paCounties.setRenderer(new SimpleRenderer(symbol));
map.addLayer(paCounties);

Then I try to trigger it on mouse over:

        paCounties.on("mouse-over", function (evt) {
            var query = new Query();
            query.geometry = evt.graphic.geometry;
            paCounties.selectFeatures(query, FeatureLayer.SELECTION_NEW);
        });

Which seems to highlight the county I am mousing over and all the counties around it.

share|improve this question

2 Answers 2

rather than duplicating the graphics in your featureLayer and then worrying about how display hierarchy is affecting the display of popups, you might consider setting a custom selection symbol for your feature layer instead. this is another, perhaps more straightforward technique to differentiate features of interest.

featureLayer.setSelectionSymbol()

featureLayer.selectFeatures()

share|improve this answer
    
John Thanks for the tips. I have tried several ways to get this selection symbol to work but can't figure out how it is supposed to work? Do you have any sample you could point to? I will edit above to show my latest try. –  Xaxum Sep 11 '13 at 19:51

I would try doing an aspect in dojo and link up your add event before the mouse over event is fired. This will not really alter the default behavior but still gets you the same effect.

http://livedocs.dojotoolkit.org/dojo/aspect

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.