Can I limit Near Me widget results data?

1527
4
Jump to solution
05-15-2017 02:46 PM
DCWORK_GIS
New Contributor III

Hi all,

I'm using the Near Me widget to identify locations in a layer that is geocoded, so its attribute table contains a lot of fields. I only want to display 2 or 3 of the nearly 20 fields returned for each result. I found these fields listed in the stemapp/predefined-apps/MY_APP_NAME/configs/NearMe config file inside the "fieldInfos" array and each item has a set of name : value pairs like this -

    {
       "fieldName": "Entity_Name",
       "label": "Entity_Name",
       "isEditable": true,
       "tooltip": "",
       "visible": true,
       "format": null,
       "stringFieldOption": "textbox"
    },

I tried setting "visible" to false, as well as removing all the fieldNames that I didn't need, but neither of those had any effect. Any idea how to limit the number of items displayed?

Thanks!

-Dan

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
AllisonMuise1
Occasional Contributor III

The information displayed in Near Me is pulled from the popup configuration. Try editing the popup for the layer so that only the fields you want displayed in Near Me are visible in the popup. Save the map and refresh your app. You should now see only those fields that were visible in the popup when you look at the results of your Near Me search.

Information on configuring popups: Configure pop-ups—ArcGIS Online Help | ArcGIS 

-Allison

(PS: you might want to try this on a configuration where you have not altered the code. Code alterations are not necessary to change the display of information and may have unintended consequences with regards to the steps I've outlined)

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Dan,

  I don't use the Near Me widget, but the json file you would want to alter is not going to be in the stemapp folder it would be [install dir]\server\apps\[app #]\configs\NearMe\config_NearMe.json

DCWORK_GIS
New Contributor III

Thank you very much Robert,

I tried to edit the file you mentioned but that doesn't seem to have any effect either. I also tried editing a .js file: [SERVER]/[WEB-APP]/jimu.js/dijit/FieldStatistics.js, but couldn't get any change to occur at all. I found that file by selecting the text I want to modify, then looking at the browser source code for that text to find a searchable attribute. I found an HTML table with 'class="attrTable"' and ran a multi-file search on the entire WAB directory for the string "attrTable", finding it in only that one file - FieldStatistics.js. I thought for sure I would be able to have some effect on that block of HTML by modifying the right piece of JS, but could not get any changes to occur. I was at this time working on a local WAB instance and stopped & restarted the server and cleared my browser cache before testing each change.

I tried many things including hard-coding a string result, explicitly setting a value to a variable used in the loop, I tried deleting the block of JS that was used to write the HTML - nothing had any effect. The only thing that did have any effect was changing the filename of that JS file - which broke the app. The loading screen would display but go no further and there was an error message in the developer console. So WAB seems to need that file, but I have no clue as to how it's being used.

I decided to download the app and deploy it to a web-server to see if I could isolate anything that way, but I'm still at a loss. I cannot seem to modify the results returned by modifying any of the files I've tried so far. I'm at a complete loss and frankly this is making me really question my own capabilities!

I haven't tried restarting the Apache server it's hosted on before testing changes as I didn't think that was actually necessary - but perhaps I should try that as well to cover all bases.

Any thoughts? Would you happen to know anyone who is very familiar with this widget?

Thanks again.

0 Kudos
AllisonMuise1
Occasional Contributor III

The information displayed in Near Me is pulled from the popup configuration. Try editing the popup for the layer so that only the fields you want displayed in Near Me are visible in the popup. Save the map and refresh your app. You should now see only those fields that were visible in the popup when you look at the results of your Near Me search.

Information on configuring popups: Configure pop-ups—ArcGIS Online Help | ArcGIS 

-Allison

(PS: you might want to try this on a configuration where you have not altered the code. Code alterations are not necessary to change the display of information and may have unintended consequences with regards to the steps I've outlined)

DCWORK_GIS
New Contributor III

You're the BEST! Thank you thank you thank you!