Group Filter widget set visible layers

444
3
06-20-2018 01:39 PM
ChadRicks
New Contributor III

The Group Filter widget sets all filtered layers to visible even if the layer in the web map was initially not visible.

In the Group Filter Widget.js, I commented out a line from the setupFilterToApply fuction:

//layer.layerObject.setVisibility(true); 

Now when i run the group filter the layers that are initially visible from the web map are shown. But, if I had gone into the layerlist widget and turned on and off different layers the group filter doesn't see what is currently visible.

Is there a way to tell what layers are currently visible in the web map? 

then i could something like:

if(layer.isCurrentlyVisible){

layer.layerObject.setVisibility(true); 

}

else{

layer.layerObject.setVisibility(false); 

}

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Chad,

   Are you using WAB 2.8? The reason I ask is that line is already commented out in 2.8 so esri must have made some changes to the widget which might help you.

ChadRicks
New Contributor III

Ok. I'm using WAB 2.3. I'll have to try out 2.8 and see if that issue is taken care of. 

0 Kudos
TomasLopes3
New Contributor II

I came here looking for a solution to the same issue Chad Ricks was experiencing.  Updating the widget to 2.9 fixed the issue.