Select to view content in your preferred language

Webapp Builder Layer List Widget

11709
45
Jump to solution
08-18-2015 04:44 PM
JayClark
New Contributor II

My table of contents has 4 group layers (each group can have multiple layers).  When the user clicks on "Critical Area" group, I also want the event to check on and draw the "Percent Slope" group.  I'm not really interested in answering questions about why I would want to do this way, because it is kind of nutty, but rather, how to do this in the javascript code, so that I get better at tinkering with the widgets.  I'm able to write to the console if a user checks on "Critical Areas" but not at all sure how to have the code check on and draw the "Percent Slope" group:

From the "LayerListView.js" in the Layer list widger for webappbuilder:

   _onCkSelectNodeClick: function(layerInfo, ckSelect, evt) {

      if (ckSelect.checked) {

        layerInfo.setTopLayerVisible(true);

//  test how to find layer name

        if (layerInfo.title === 'Critical Areas')

           {

              console.log(layerInfo.title);

//  I want this to check on and draw another group in the layer list--Any ideas?

            }

      } else {

        layerInfo.setTopLayerVisible(false);

      }

      evt.stopPropagation();

    },

0 Kudos
45 Replies
Mehretab
Occasional Contributor II

You mean to change from one theme (group to another group) like in the above mentioned application? example From Surface Water Bodies to Protected area and so on?

You are right @ Robert Scheitlin, GISP  I am not switching between web maps, its only loading another map layers.This was accomplished via a widget created for such purpose as there is no way  to group service into categories as of today in arcgis api for javascript 3.xx, pardon me if there is possibility to group layers.

0 Kudos
ikbelkachbouri
New Contributor II

yeah i mean how to change from one group to another . is it a group of layer or webmaps ? and if it is a group of layers how to do so ? 

0 Kudos
ikbelkachbouri
New Contributor II

How to group layers please ? 

0 Kudos
ikbelkachbouri
New Contributor II

Can you explain to me more how to group layers and how to get the widget to toggle between groups of layers ? 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

So are you changing the web map in that widget?

0 Kudos
Mehretab
Occasional Contributor II

No I am clearing the previous maps and add the new group using the buttons.

ikbelkachbouri
New Contributor II

Can you explain to me more how to group layers and how to get the widget to toggle between groups of layers ? 

0 Kudos
Mehretab
Occasional Contributor II

I think It would be easy for me to share the widget than to explain it here . Give me some time though?

0 Kudos
ikbelkachbouri
New Contributor II

Ok Mr Mehretab T.Sium . Thank you so much . really thank you so much .

0 Kudos
AmalHorchi
New Contributor II

Hi Mehretab , 

What about the widget  to toggle betwenn group of layers ? 

0 Kudos