Search widget when single source

615
1
12-10-2020 05:51 AM
RayMckaig
New Contributor

I have a problem with the Search widget when I only have one source.

In my application the sources array is updated depending on what layers I dynamically add to the map.

I have three layers that can be added using two visual elements. The first option ("Fields") adds one layer and the other ("Blocks") adds two. After the appropriate layers are added, I execute this code:

fieldBlockSearchWidget.set("activeSourceIndex", 0);
fieldBlockSearchWidget.set("enableSourcesMenu", blockLayerVisible);
fieldBlockSearchWidget.set("enableSearchingAll", blockLayerVisible);
fieldBlockSearchWidget.set("sources", sources);
fieldBlockSearchWidget.startup();

I've found that when there is only one source, the sources dropdown is empty and only shows an outline.

I've tried setting the "enableSroucesMenu" attribute to false when there's only one layer to no avail.

The styling of the sources button does change when there's only one source but it's still visible.

Is there something I'm missing?

Tags (3)
0 Kudos
1 Reply
RayMckaig
New Contributor

Hopefully you can see the attached images

0 Kudos