configuring searchbox in HeaderControllerWidget 3.1

815
14
Jump to solution
12-21-2012 12:12 AM
MattiasEkström
Occasional Contributor III
I really like the idea of the new searchbox in the HeaderControllerWidget, but I'm not able to configuring it as I want. Don't know if I'm doing it wrong or if it's impossible without changing the source code.
I want to use my own searchlayers and no locator at all, and I want the results to display as graphics.
First of all I think the conceptual graphic in the documentation is wrong, it looks like the <labels> tag and <symbols> tag is supposed to be in the <searchlayer> tag, but in the text it says they should be in the <search> tag which seems to be correct.
My config-file looks like this (the search tag):
<search>         <searchlayers>             <searchlayer>                 <url>http://oskar75:6080/arcgis/rest/services/test/Sokning/MapServer</url>                 <layerids>0,1,2</layerids>                 <searchfields>FASTIGHET,ADRESS,TEXT</searchfields>             </searchlayer>                   </searchlayers>  <zoomscale>5000</zoomscale>  <labels>   <searchprompt>Skriv fastighet, adress eller plats</searchprompt>   <noresults>Inga träffar hittades</noresults>   <searchresulttitle>Sökträff</searchresulttitle>   <clearfeaturelabel>Rensa</clearfeaturelabel>  </labels>  <symbols>   <simplemarkersymbol color="0x00FFFF" alpha="0.7" size="10"/>   <simplefillsymbol color="0x00FFFF" alpha="0.5">    <outline alpha="0.9" width="2"/>   </simplefillsymbol>  </symbols> </search>

The search works fine for my three layer ids but also displays searchresult from what I guess is the default locator. Is there anyway to disable that?
I don't see any graphics to my results though, is something wrong with my <symbols> tag? (My layers are one polygon layer and two point layers).

My last wish I think would require editing the source code (maybe something for the next version?), I would like the resultlist to display and update while typing, without pressing enter, after the users has entered a number of characters (for example 4 or 5).
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
HeatherGonzago
Esri Contributor
Just a little clarification to help ease any confusion.

The Search Header is currently designed to work to always use the geocoding locator service, whether you specify the default or one of your own. If you do choose to work with your own layers as well and add the <searchlayers> tag, it will use both the locator AND the layers you specify.

The documentation has been updated to reflect this as to hopefully avoid anymore confusion.

http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Header_Controller_widget_tags/0...
http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Header_Controller_widget/01m300...

Thanks for your patience, and enjoy the new functionality:-)

View solution in original post

0 Kudos
14 Replies
HeatherGonzago
Esri Contributor
I really like the idea of the new searchbox in the HeaderControllerWidget, but I'm not able to configuring it as I want. Don't know if I'm doing it wrong or if it's impossible without changing the source code.
I want to use my own searchlayers and no locator at all, and I want the results to display as graphics.
First of all I think the conceptual graphic in the documentation is wrong, it looks like the <labels> tag and <symbols> tag is supposed to be in the <searchlayer> tag, but in the text it says they should be in the <search> tag which seems to be correct.
My config-file looks like this (the search tag):
<search>
        <searchlayers>
            <searchlayer>
                <url>http://oskar75:6080/arcgis/rest/services/test/Sokning/MapServer</url>
                <layerids>0,1,2</layerids>
                <searchfields>FASTIGHET,ADRESS,TEXT</searchfields>
            </searchlayer>          
        </searchlayers>
 <zoomscale>5000</zoomscale>
 <labels>
  <searchprompt>Skriv fastighet, adress eller plats</searchprompt>
  <noresults>Inga träffar hittades</noresults>
  <searchresulttitle>Sökträff</searchresulttitle>
  <clearfeaturelabel>Rensa</clearfeaturelabel>
 </labels>
 <symbols>
  <simplemarkersymbol color="0x00FFFF" alpha="0.7" size="10"/>
  <simplefillsymbol color="0x00FFFF" alpha="0.5">
   <outline alpha="0.9" width="2"/>
  </simplefillsymbol>
 </symbols>
</search>

The search works fine for my three layer ids but also displays searchresult from what I guess is the default locator. Is there anyway to disable that?
I don't see any graphics to my results though, is something wrong with my <symbols> tag? (My layers are one polygon layer and two point layers).

My last wish I think would require editing the source code (maybe something for the next version?), I would like the resultlist to display and update while typing, without pressing enter, after the users has entered a number of characters (for example 4 or 5).




Good catch! You are correct, the labels and symbols are not in the correct location in the graphic. We will update that ASAP. Please refer to what is referenced in the text.

As for using ONLY searchlayers and not the default geocode locator as well... this should be working like that already. I do see what you are referring to. When putting in ONLY searchlayers I am getting requests made to both the layers in addition to the geocode locator. There was another post regarding the default locator always being used so I'm thinking there may be more to all of this. We'll look into it and see what may be causing the problem and get back to you ASAP.

Thanks.
0 Kudos
HeatherGonzago
Esri Contributor
Just a little clarification to help ease any confusion.

The Search Header is currently designed to work to always use the geocoding locator service, whether you specify the default or one of your own. If you do choose to work with your own layers as well and add the <searchlayers> tag, it will use both the locator AND the layers you specify.

The documentation has been updated to reflect this as to hopefully avoid anymore confusion.

http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Header_Controller_widget_tags/0...
http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Header_Controller_widget/01m300...

Thanks for your patience, and enjoy the new functionality:-)
0 Kudos
HeatherGonzago
Esri Contributor
Also, for the results displaying incorrectly. Please take a look at what I replied in this thread, http://forums.arcgis.com/threads/73768-Searchbox-in-3.1?p=262305&posted=1#post262305.
0 Kudos
MattiasEkström
Occasional Contributor III
Thanks for the info!
I think it would be good to be able to not use the default geocode service for the feature, but I'm working with the uncompiled code now and uses Roberts fix from this thread so that works for me.
I still have some problems with the result graphics though.
When using keyboard arrows and pressing enter on one result in the result list the graphic appear, and if I'm typing a searchterm that only gets one result the graphic appear as well. But when clicking with the mouse on a result in the result list the info window shows and the map zoom in to the result but no graphic appears.
Is this a bug, or is it just me who experience this behavior?
(It is the same when I use the compiled version as well so it's not because of any code change by me.)
0 Kudos
HeatherGonzago
Esri Contributor
Take a look at what JC wrote in this post. Would this apply to your situation?

http://forums.arcgis.com/threads/73768-Searchbox-in-3.1?p=262795&viewfull=1#post262795
0 Kudos
MattiasEkström
Occasional Contributor III
No it doesn't. I have no problems with the extent och projecting, the map zooms to the correct location and show to info window, It's the result graphic that doesn't show when mouse clicking in the result list. When using keyboard arrows and enter the graphic shows up.
0 Kudos
J_B__K_
New Contributor III
Hi! Mattias is not alone with this issue 🙂 I´m having the same problem - when using keyboard (arrows and enter), the graphic shows, but when using mouse to click the result, the graphic does not show (location and info pop-up are correct)! Any ideas?

btw. Robert´s modification (to use just custom layers, not default geocode service) works great, thank you!
0 Kudos
MichaelVolz
Esteemed Contributor
Mattias:

Can you provide a link to your app so I can see how it works?  I am interested in using this functionality in my app, but the labels items that I configured are not displaying as I expect.
0 Kudos
RhettZufelt
MVP Frequent Contributor
No it doesn't. I have no problems with the extent och projecting, the map zooms to the correct location and show to info window, It's the result graphic that doesn't show when mouse clicking in the result list. When using keyboard arrows and enter the graphic shows up.


Was wondering why it sometimes would put a result graphic on it, sometimes not.

Also, would be nice if there was either a clear button, OR have it clear itself after a search.  If the matching text is very long, one has to select/delete, select/delete until you can get all the text cleared for the next search.

R_
0 Kudos