Expose all services for search widget

5755
25
Jump to solution
06-24-2016 08:40 AM
EmersonChew2
New Contributor II

I'm new to this forum so I hope my post follows the proper guidelines.  I'm also new to web app builder development so if the post is confusing I can try to clarify further if needed.

I have been tasked with framing up a "Layer Search" Widget for one of our web mapping applications.  Currently, we have roughly 1,000 layers in the layer list widget and navigating to those layers can be quite cumbersome for most of our users. To that end, I'm researching a method to allow a search against all of the layers in our layer list widget and then pushing  these to a pop-up panel.  From there, the user could select one of the layers in the pop up and the corresponding layer in the layer list would be drilled into and opened.

First and foremost, is there even a method that allows one to use a contains operator against the entire web map and second, once that information is retrieved is it possible to be received inside the layer list widget?

I'm still in the framing stage so any suggestions are welcomed and appreciated.  I'm just trying to determine the best point of entry--is it using the search widget base and push to layer list or enter the map via the layer list widget itself...again, sorry if this is doesn't pertain to this group.  If I need to take to another forum please let me know

Cheers.

0 Kudos
25 Replies
BrianGallegos
New Contributor III

Robert,

I'm almost certain I'm on 2.1, but I don't know how to verify that, and haven't been able to find anything online. 

Brian

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brain,

  There are several ways to verify that but probably the easiest way is to add the about widget.

0 Kudos
BrianGallegos
New Contributor III

Robert,

So easy!  Any other ideas why it's not working?  Thanks so much, for help on this and your widgets (I use three of them)!

Product Version: Web AppBuilder for ArcGIS (Developer Edition) 2.1
Kernel Version: 2.1
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brian,

   OK so the attachment from https://community.esri.com/message/628934-re-expose-all-services-for-search-widget?commentID=628934#... is the replacement for the OTB LayerList widget so you extract the contents of the zip to your apps widgets folder allowing it to overwrite the LayerList folder (i.e. [install dir]\server\apps\[app#]\widgets). Then your app will have the LayerList widget with the filter box at the top.

0 Kudos
BrianGallegos
New Contributor III

Thanks so much!  I was trying to add the it the same as the other widgets here, client\stemapp\widgets.  I have it in the map now but I'm having the same issue posted about the filter button being grey/inactive.  Any thoughts?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

All,

  Here is some updated code that will allow the first level of sublayers in a map service to be filtered and expanded (if you have sublayers that are nested multiple layers deep then only the first level will be filtered):

//RJS Added
      _onFilterClicked: function (){
        var LayerTitles = [];
        array.forEach(this.operLayerInfos.getLayerInfoArray(), function(layerInfo) {
          if(layerInfo.title.toLowerCase().indexOf(this.filterTextBox.value.toLowerCase())> -1){
            var titleNodes = query(".div-content.jimu-float-leading");
            for(var x = 0; x < titleNodes.length; x++){
              if(titleNodes[x].innerHTML === layerInfo.title){
                 var layer1Table = document.querySelectorAll("[layercontenttrnodeid='" + titleNodes[x].parentNode.parentNode.getAttribute("layertrnodeid") + "']")[0].childNodes[0].childNodes[0];
                 var img = document.getElementsByClassName("showLegend-image")[0];
                 this.layerListView._onRowTrClick(layerInfo, img, layer1Table.childNodes[0], layer1Table);
                 this.layerListView._changeSelectedLayerRow(titleNodes[x].parentNode.parentNode);
              }
            }
          }else if (layerInfo.newSubLayers.length > 0){
            array.forEach(layerInfo.newSubLayers, function(slayerInfo) {
              if(slayerInfo.title.toLowerCase().indexOf(this.filterTextBox.value.toLowerCase())> -1){
                var titleNodes = query(".div-content.jimu-float-leading");
                var layer1Table, img;
                for(var x = 0; x < titleNodes.length; x++){
                  if(titleNodes[x].innerHTML === slayerInfo.parentLayerInfo.title){
                    layer1Table = document.querySelectorAll("[layercontenttrnodeid='" + titleNodes[x].parentNode.parentNode.getAttribute("layertrnodeid") + "']")[0].childNodes[0].childNodes[0];
                    img = document.getElementsByClassName("showLegend-image")[0];
                    this.layerListView._onRowTrClick(layerInfo, img, layer1Table.childNodes[0], layer1Table, {});
                  }
                  if(titleNodes[x].innerHTML === slayerInfo.title){
                     layer1Table = document.querySelectorAll("[layercontenttrnodeid='" + titleNodes[x].parentNode.parentNode.getAttribute("layertrnodeid") + "']")[0].childNodes[0].childNodes[0];
                     img = document.getElementsByClassName("showLegend-image")[0];
                     this.layerListView._onRowTrClick(slayerInfo, img, layer1Table.childNodes[0], layer1Table, {});
                     this.layerListView._changeSelectedLayerRow(titleNodes[x].parentNode.parentNode);
                  }
                }
              }
            }, this);
          }
        }, this);
      },
//RJS End Add