Select to view content in your preferred language

Configure Popup for Search Results

10809
16
01-14-2016 04:31 PM
HamishKingsbury1
Deactivated User

Hi All

Using WAB and the default search tool I'm wanting to search some feature layers. I've successfully added the feature layers (three of them) and can search and find specific features. However, what I want to do is configure a custom popup for the returned results (a different template for each of the three). How do I go about doing this? I've searched here and google but haven't come up with anything substantial.

For example, in the below image, I have searched for the area with 'OBJECTID = 1'. The popup that appears shows all the attributes, but I only want the popup to contain (for example) 'TYPE', 'AREA' and 'LENGTH'.

ss+(2016-01-15+at+01.26.36).png

Can anyone help me out? I feel like it may be something fairly simple with the config....

Cheers

Hamish

16 Replies
WilliamMiller4
Deactivated User

Thank you Robert. How do I create a new array? Would this work:

 selectedAttrs = new array(aliasAttrs[2],aliasAttrs[10],aliasAttrs[13],aliasAttrs[14],aliasAttrs[15],aliasAttrs[21],aliasAttrs[24],aliasAttrs[38],aliasAttrs[39]);

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

William,

  You don't want a new array. I would say you want something like this:

          var aliasAttrs = {},  selectedAttrs = {};
          array.forEach(fLayer.fields, lang.hitch(this, function(field) {
            if (field.name in graphic.attributes){
              if(field.name == "your first field name" || field.name == "your second field name"){
                selectedAttrs[field.alias || field.name] = graphic.attributes[field.name];
              }
              aliasAttrs[field.alias || field.name] = graphic.attributes[field.name];
            }
          }));
WilliamMiller4
Deactivated User

SUCCESS!!! Thank you Robert!

0 Kudos
by Anonymous User
Not applicable

Hey Robert -- i'm having a similar (the same?) issue in my search. 

Here is the app: ArcGIS Web Application  

If you search for an address (2003 Union St) it will find the address alright, but the side panel pop-up just shows 'show more results' rather than the pop-up that corresponds to that feature. If you select the parcel you'll see the proper pop-up []

Is there a way to modify the Search widget to always return the parcel that corresponds to the returned result? Does that make sense?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   As mentioned earlier in this thread the search widget does Not open the features configured popup from the web map. To do this you would have to do some customized code to get the search result geometry and them through code fire a click event for the parcel layer to show it's configured popup. If you are wanting help with that code then you will need to start a new thread with that question.

PeterGranberg
Occasional Contributor

I have my features editable, but for the same reason I cant get the search widget result popup to switch to edit mode. The Edit-option is simply not available as it is when the web map layer popup is shown. Its quite frustrating since i have many point objects ontop on each other, and I want to search for a specific point and edit attributes and location.

0 Kudos
NadineHughes2
Emerging Contributor

The exact same thing is happening to me as per Peter Granberg. I have configured search layer in search window, it DOES show pop up as per setting in map, but the edit function is disabled. This means if I want to edit a feature I have searched for, I search in tool bar, get pop up, have to close that pop up, remember what feature the search return, and re click, to get the pop up with editing capabilities. Very frustrating... any suggestions??

0 Kudos