Select to view content in your preferred language

Customize add widget

785
5
12-20-2017 01:19 AM
aishvaryvardhan
Occasional Contributor

I am customizing add widget and want to add new layers after a define html .. which is defined in widget.html in layerlist widget. Also I am adding layers by layer list widget.. 
by default the layer are adding on top i want them in after the html.

Please find snapshot for better understanding 

Any lead on this is highly appreciated 

Thanks 

Ash

Tags (1)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

???... I am totally at a loss here. what are you asking?

0 Kudos
aishvaryvardhan
Occasional Contributor

Hi Robert

I guess this image will give a better picture to you.

Its like some layer I have added by layer list widget and there is some other HTML . I then want to add more layers from add data widget provided it should come after html but by default it is coming in the section above HTML 

Thanks 

Ash

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

OK,  I see what you are after now but sorry I don't have any suggestions.

aishvaryvardhan
Occasional Contributor

Thanks Robert for your pointers

0 Kudos
KoenDemonie
Occasional Contributor

If i'm understanding your situation correctly, you want to have a custom widget that consists out of :

  • A Layerlist widget,
  • some HTML, 
  • A second Layerlist widget.

The first layerlist widget should match the initial webmap layers, and the second layerlist should match the newly added layers.

An important note to take from the Layerlist widget is: when providing a "layers" param, the layerlist will only listen to changes to these provided layers. So for the first requirement, the first layerlist... it can easly be done, by using 'jimu/LayerStructure' to build the initial layer tree. 

tip :

LayerStructure.getInstance().getWebmapLayerNodes();

This is why it's being added above your HTML block, if the layers property of the map LayerList widget is undefined, it will take the list from the map.

- see : https://developers.arcgis.com/javascript/3/jsapi/layerlist-amd.html#layers

Then for the second layerlist you'll need to listen to the map's "layer-add" event and add it to your second layerlist.

- see Map | API Reference | ArcGIS API for JavaScript 3.28 

 

0 Kudos