Can I customize the LayerList widget to add non-interactive descriptive text lines between layers listed.

3493
32
Jump to solution
01-19-2018 12:48 PM
BenjaminGrover
New Contributor II

I've seen some talk about this in other discussions, but no solid solutions.  Where would one need to add code to insert text lines between layers in the LayerList widget?  I'm wanting to add some descriptive text, smaller font, bolded, and in red, below a few layers listed in the Widget. Can this be done??

0 Kudos
32 Replies
BenjaminGrover
New Contributor II

Am i correct in assuming the "LOJIC_LandRecords_Louisville_5606" layer ID you used, is the published web service's name? As in the bolded text here from the service URL: /arcgis/rest/services/ProjectName/Abandoned_ServiceLines/MapServer

Or should I be using something else?

There are several layers under this abandoned service lines service. Should the Layer ID i need to be using, be for each of these individual layers from within the Abandoned Service Lines service?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ben,

  No. The best way to find the layers id is to right click the layer title in the LayerList widget and to choose inspect (i am using Chrome) then in the elements class you will see the layers id.

i.e.

<div class="layer-title-div-LOJIC_LandRecords_Louisville_5320 div-content jimu-float-leading ">LOJIC_LandRecords_Louisville - LandUse</div>

BenjaminGrover
New Contributor II

Got it to work. Thanks!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Great Don’t forget to mark your question is answered.

0 Kudos
BenjaminGrover1
New Contributor II

Robert,

Wondering if you have any ideas as to where the code may have changed in more recent versions of WAB that would cause the non-interactive label text in the layerlist that you helped me with above to do this:

Whenever I use the measure tool, or change the basemap in the basemap gallery, my labels move from where they're supposed to appear beneath their respective layers in the laylist, to all being stacked up together at the very top of the layerlist.  I can attach a screen shot if my description is not clear.  Any help would be appreciated. 

note: I'm running WAB 2.11 now.  The code works fine until I use these tools, there may be other actions that cause it to do this as well, but these are all i've found so far.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Benjamin,

  Sounds like they are using the .desc class somewhere else in WAB now and the css rule I have is not specific enough. So the easiest way to fix this is to change the css class name to something more unusual, like myDesc

.jimu-widget-layerList .myDesc{
....
...
          var layerTrNode = domConstruct.create('tr', {
            'class': 'myDesc',
            'layerTrNodeId': 'LOJIC_LandRecords_Louisville_4356'
          });
...
0 Kudos
BenjaminGrover1
New Contributor II

That didnt seem to make any difference. I changed the .desc code in the css file to .LayerNote; and the following code in the widget.js file:

'class': 'desc',

for each label's instance of this code I changed to this:

 'class': 'LayerNote',

and it functions the same way. All the labels appear correctly, until I use the measure tool.  Havent checked changing the basemap with gallery yet though, so no way of telling if its fixed it from occurring with that action..  the app I'm testing this in doesn't have a basemap gallery to try it with unfortunately.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Strange I don’t se that behavior in 2.11 when using the measure tool. I just assumed it was a class issue. Is your app that is experiencing this a public app?

0 Kudos
BenjaminGrover1
New Contributor II

I suspect now that it has something to do with the function of the draw tool and measure tool both having the functionality of adding a operational layer temporarily to the layer list when it is used.  but even after clearing the measure and draw widgets of any measurements or drawings the labels still stay stacked at the top of the layerlist.

That still doesn't explain why it would happen when I change the active basemap with the basemap gallery widget though I don't think.

0 Kudos
BenjaminGrover1
New Contributor II

The WAB app is on an external web server so the site is publicly accessible, but all the layers within are secured as well as the web map that the app is referencing to..

0 Kudos