Modify existing search widget in WAB (text-box to drop-down List)

1079
2
10-12-2016 06:46 AM
FelixciaBlanchard2
New Contributor II

Hello,

I would like to modify the Search Widget available in WAB so that I can select values within a layer.

I currently have the search box set up to search a layer by the field "name" when typed in the text box, but I would like these names available in a drop-down menu.  I have attempted to rearrange code and use bits from other widgets that contain drop-downs but I receive errors.

Current html code for search widget (out of the box from ESRI):

<div>
<div data-dojo-attach-point="searchNode" class="search-node"></div>
<div data-dojo-attach-point="searchResultsNode" class="searchResults arcgisSearch"></div>
</div>

Code containing the drop-down function (from eSearch widget by Robert Scheitlin, GISP) :

<select class="esearch-select" style="margin-bottom:10px;float:left;"
data-dojo-attach-point="selectLayerGraphical" data-dojo-type="dijit/form/Select"></select>
<div data-dojo-type="dijit/form/DropDownButton" data-dojo-attach-point="gSelectType" iconclass="newSelIcon"
class="selectionmenu"><span></span>

How would I be able to use the 2nd to modify the 1st?..correctly

Thank you!

Tags (1)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

F Blanchard,

  If you are using ArcGIS server 10.3.1 or greater then the search widget will provide a drop down list of suggestions automatically. Short of this you are on your own. The reason my eSearch provides a drop down list is because I have a completely different code base that performs queries on the map service data to be unique values from the map service layer field. There is no simple add a couple of lines of code and your done.

0 Kudos
FelixciaBlanchard2
New Contributor II

Thank you Robert. I appreciate your reply.

Yes I am using 10.4. Naively I thought it would be as simple as just changing the box type in the html file. I am quickly learning these develops  are not so easy. I am very new to widgets and app modifications.

Thanks a bunch!

0 Kudos