Change or remove selection color?

7666
19
Jump to solution
11-13-2014 07:04 AM
StaffanstorpsKommun
New Contributor III

Is it possible to change or remove the outline color when querying/selecting a feature? We have invisible polygons (no fill or outline color) which we want the user to be able to query and get a popup from in our web map. However, we don’t want the polygon to get selected with the default cyan color, since they are meant to be invisible. The map is an ArcGIS Online web map which is presented in a story map template, which we have downloaded to our web server. There is no “query”- or “onClick”-call in the js-code for the story map template, so we don’t know what to do?

1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Staffanstrops,

  To change the color of the selection you would set the fillsymbol or the linesymbol of the popup.

        //initialize popup window

        var popup = new esri.dijit.Popup({

        fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]))

        }, dojo.create("div"));

You can also find out how to disable the selection in the popup documentation.

Here is the documentation reference:

popup-amd | API Reference | ArcGIS API for JavaScript

View solution in original post

19 Replies
RobertScheitlin__GISP
MVP Emeritus

Staffanstrops,

  To change the color of the selection you would set the fillsymbol or the linesymbol of the popup.

        //initialize popup window

        var popup = new esri.dijit.Popup({

        fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]))

        }, dojo.create("div"));

You can also find out how to disable the selection in the popup documentation.

Here is the documentation reference:

popup-amd | API Reference | ArcGIS API for JavaScript

StaffanstorpsKommun
New Contributor III

Wow, much simpler than we expected ! Thanks Robert!

0 Kudos
MarcBate
Occasional Contributor II

Do I just create the popup after I create the map, or do I assign it to a featurelayer?

RobertScheitlin__GISP
MVP Emeritus

Marc,

  Just use map.infowidow.fillSymbol = x;

LeroyChristophersen
New Contributor II

Hi Robert,

I am having this same issue.  What folder or file contains the "

  1.         //initialize popup window  
  2.         var popup = new esri.dijit.Popup({  
  3.         fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]))  
  4.         }, dojo.create("div")); 

as shown earlier.  I am using the out of the box Search and want the item found to just be highlighted with no fill covering the location.

I've looked int the Config for the Search and Selection widgets, but do not see the popup file.

Thanks,

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Leroy,

  OK, I see the issue is you are asking about WAB but you are in the native JS API space. Your question is better placed and already answered in the WAB space.

https://community.esri.com/thread/165739 

0 Kudos
LeroyChristophersen
New Contributor II

Thanks Robert.

That takes care of what I needed.

Leroy A. Christophersen

Sent from my Wireless smartphone

0 Kudos
LeroyChristophersen
New Contributor II

Thanks Robert.

I checkedout the answer link. Is there a better tool for reviewing and editing the .js file other than notepad++?

Using notepad++ lines of code run together. Most of the other languages, it works quite nicely.

Leroy A. Christophersen

Sent from my Wireless smartphone

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Leroy,


  The only reason the code wold be running together in Notepad++ is you are trying to edit minified code (I.e. code downloaded from AGOLs WAB). If you want to make code changes you really need to get WAB Dev and start from there.