Customize Legend Widget in WAB 2.6

420
5
07-08-2018 09:45 PM
BineetBara
New Contributor

Hi,

I am having tiled map services as a base map for which legend is not shown in Legend widget. I created images for different scales and toggle the images at zoom in/out. in the legend widget. The image comes above the dynamic feature layer legend , I want it below the dynamic legend shown below.

Legend

Kindly help.

Regards,

Bineet

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Bineet,

   What does your code look like for placing this item?

0 Kudos
BineetBara
New Contributor

How can I put custom legend HTML in bottom of dynamic legend HTML?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

You do a query for the DOM object and use domContruct place to place the new element in your desired location.

0 Kudos
BineetBara
New Contributor

Hi,

I have tried this but it is not working as expected.

As per my requirement static legend should come after dynamic legend which is dynamically generating. 

I have attached widget.js and widget.html with screenshots.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Bineet,

  So your issue is that you have this line in your onOpen function:

this.legend = new Legend(legendParams, html.create("div", {}, this.domNode));

Which means that each time your widget is opened you create a Legend dijit and place it in the widgets main dom node. You do not specify a specific div in the widgets template to place the Legend Dijit in. This is how the OTB widget was developed but you are trying to add your elements at a specific position so you can not use that method.

0 Kudos