FeatureLayer not accessable when using the LayerSwipe widget

772
6
Jump to solution
03-28-2014 07:02 AM
MarkPorter
New Contributor II
I have a map where I am using a feature layer to display information in a popup box as the mouse hovers over a parcel.
I then added a LayerSwipe widget to allow the viewing of 2 different displays of a layer (on/off compared to amount used)

When I enable the LayerSwipe  widget, I no longer have access to the feature Layer for mouse hover over the parcel.
If I disable LayerSwipe, I can once again use the feature layer hover.

Both work, just not together.

How can I use both Feature Layer and LayerSwipe in the same map?

Thanks for the help.
Mark Porter
0 Kudos
1 Solution

Accepted Solutions
MarkPorter
New Contributor II
The first suggestion you gave me worked with one exception. I had to change the 'last' to 'first'.
The web map now works with my feature hover and the layer swipe both operational as designed.

Your help is greatly appreciated.
Mark Porter

I think I understand the problem.

Can you try moving the swipe domNode into the map domnode? After the widget is loaded probably.

Currenlty, the widget gets placed into the layers div but I think that is causing the hover issue.

Like this:

domConstruct.place(mySwipeWidget.domNode, dom.byId('my_map_id'), 'last');

View solution in original post

0 Kudos
6 Replies
MattDriscoll
Esri Contributor
Do you have a sample you could post or link to?
0 Kudos
MarkPorter
New Contributor II
Hi Matt

Here are the links to a temporary demo I set up.
I disabled the username and password, so you only need to click on the login button.

Both maps are the same code with one exception. In the noswipe link, i don't startup the swipe widget.

This link does not startup the swipe widget and the mouse over the parcel popup works as designed.
http://gis.eid.ab.ca/demo/noswipe/idars.html

This link has the swipe widget started and the mouse over the parcel popup no longer works.
http://gis.eid.ab.ca/demo/swipe/idars.html

Thanks for the help
Mark
0 Kudos
MattDriscoll
Esri Contributor
I think I understand the problem.

Can you try moving the swipe domNode into the map domnode? After the widget is loaded probably.

Currenlty, the widget gets placed into the layers div but I think that is causing the hover issue.

Like this:

domConstruct.place(mySwipeWidget.domNode, dom.byId('my_map_id'), 'last');
0 Kudos
MattDriscoll
Esri Contributor
Or you can overwrite the widget "_init" function to this:


_init: function() {
            // set type of swipe
            this._setSwipeType();
            // events
            this._setupEvents();
            // check if not enabled
            this._enabled();
            // we're ready
            this.set("loaded", true);
            this.emit("load", {});
            // giddyup
            this.swipe();
        },
0 Kudos
MarkPorter
New Contributor II
The first suggestion you gave me worked with one exception. I had to change the 'last' to 'first'.
The web map now works with my feature hover and the layer swipe both operational as designed.

Your help is greatly appreciated.
Mark Porter

I think I understand the problem.

Can you try moving the swipe domNode into the map domnode? After the widget is loaded probably.

Currenlty, the widget gets placed into the layers div but I think that is causing the hover issue.

Like this:

domConstruct.place(mySwipeWidget.domNode, dom.byId('my_map_id'), 'last');
0 Kudos
MattDriscoll
Esri Contributor
Ok great. In API release 3.10 you shouldn't have to move the node anymore.
0 Kudos