Select to view content in your preferred language

Select Features from Invisible Layer and Zoom To Them

519
1
Jump to solution
02-04-2022 01:36 PM
NathanHeickLACSD
Frequent Contributor

I'm running into some issues trying to customize the Search widget.  The use case is as follows.

  1. Refresh the app and open it to the initial extent.
  2. Have layers that are not visible at the initial extent.
  3. Select features from the invisible layers.
  4. Zoom to the selected features.

It appears that what is happening is that when you zoom to the selected features, it causes the hidden layers to draw for the first time.  This calls resume on the layers, which appears to clear any selections on the layer if it is the first time resume has been called.  This basically clears out the selection from step 3.  I found similar behavior in the Attribute Table widget.  If you double-click on a feature that is not visible, it will zoom to it.  If it is the first time that the given layer has been displayed, the zoom ends up clearing the selection.  You can see it in how the blue color in the row disappears.  If you double-click it again, the blue color stays.  The issue is the same with my Search widget.  It is only an issue the first time the layer is displayed.  After that, it works correctly.

Any ideas?

0 Kudos
1 Solution

Accepted Solutions
NathanHeickLACSD
Frequent Contributor

Eventually, I decided that the best solution was just to host the JS 3.x API internally and remove the offending call to clearSelection.  That fixed the issue.  I still don't know why there is a need to clear a layer the first time it is drawn.

View solution in original post

0 Kudos
1 Reply
NathanHeickLACSD
Frequent Contributor

Eventually, I decided that the best solution was just to host the JS 3.x API internally and remove the offending call to clearSelection.  That fixed the issue.  I still don't know why there is a need to clear a layer the first time it is drawn.

0 Kudos