AnsweredAssumed Answered

Restrict layers in attribute table widget in javastript?

Question asked by gregord on Feb 27, 2020
Latest reply on Mar 18, 2020 by gregord

Hello! I'm building a webapp, where you can change from several map services. In every map service there are several layers with same naming, but not with the same number of layers. I cannot set the attribute table widget up in webapp builder, because the json too hardcoded. I'm really new in javastript. Please help me!

I would make a list in js, what contains the allowed layer's  name:

layersToShow: [Layer1, Layer2, Layer3]

in the widget's _ResourceManager.js

I think here is the section from the manager, where i could repoint the reader. But i don't know how. i would add all the possible allowed layers to the list, and the js may fail to get the layerinfo. How would you accoplish this?

          if (updateConfig) {
            if (this.config.layerInfos.length === 0) {
              // if no config only display visible layers  ,egy tombot csinalok es amikor itt filterel, akkor egy consistal kerem le a tombbol
              var configLayerInfos = attrUtils.getConfigInfosFromLayerInfos(layerInfos);
              this.config.layerInfos = array.filter(configLayerInfosfunction(layer) {
                return layer.show;
              });

Outcomes