NH NearMe Search Widget

Blog Post created by bpelchat on Dec 22, 2017

A while ago we created a near me search widget similar in some ways to the one provided in wab from esri, and this was done at wab developer version 2.0.

This widget will search a spatial radius from an address location entered into the search box of the NHNearMe widget.

The search radius is controlled using the slider and will perform the search or re-search on the "change end event" of the slider control.

A clear button will clear the previous search results and when the Remove checkbox is also checked,  the result layer or layers will also be removed from the map and therefore also the attribute table and the layer list widget.

In some use cases we wanted to provide the ability to shell out to google directions, to get driving directions to or from the location and a selected feature. See the ReadMe file in the widgets download zip file for implementing this feature.

We also wanted the result list to interact with the feature on the map whenever the item in the result list is clicked or when you hover over the item in the list. You'll see the blue selection box over the feature as you hover over the item in the list.

We also tied the click event to open the popup for a feature when clicking on the item in the result list.

The hide on close check box was added for the option to leave the results layer visible on the map or not whenever the widget is closed.

If you look in the widget.js you'll also find where the widget receives messages from the search widget popup( talking about the main search widget in the web app) . The search popup was modified with an action button to send its search address to the NH NearMe search widget, auto fill the entry with that address for the NH NearMe radius and trigger a search.

To implement something like this you'll need to modify the search widget, so I attached it to this blog , see the widget.js in that zip file and look at the post create where you'll find some code for adding the action link and associated function call to send a message to the NH NearMe widget. You'll just want the code in the function that does the publishdata with the searchdijit.value which should contain the address string the user typed into the search widget.

Please be aware we may be using an older version of wab so you may want to cut and past this into your version of that widget.