| 
             
                POST		  
                
             
         | 
        
        
 
					
							    If I may I ask a related question...    Has anyone set Nianwei's AGS TOC widget to not collapse layer Groups when it is turned off? In other words, I have a dynamic service with around 100 layers. I've grouped these into a few groups which works great with the AGS widget, which groups them hierarchically just like ArcMap.     Now I am wondering how to make it NOT automatically collapse the groups when I turn them off. We want them to stay expanded, unless the user clicks the little "+" button. We do however want it to collapse/expand with the "+" automatically, as it does now by default.    I have tinkered with the 2.05 TOC.js code and I believe the relevant block of code is below but I have not succeeded. I set a lot of those visible items to true, set both expandos to "open" etc to no avail yet. Anyone else done this or know how?     
var show = this.data.visible;
    // if it is a group layer and no child layer is visible, then collapse
    
    if (this.data._subLayerInfos) {
      var noneVisible = true;
      dojo.every(this.data._subLayerInfos, function(info) {
        if (info.visible) {
          noneVisible = false;
          return false;
        }
        return true;
      });
      if (noneVisible) 
        show = false;
    }
    
    if (this.data.collapsed) 
      show = false;
    if (this.iconNode && this.iconNode.src == this.blank) {
      dojo.addClass(this.iconNode, 'dijitTreeExpando');
      dojo.addClass(this.iconNode, show ? 'dijitTreeExpandoOpened' : 'dijitTreeExpandoClosed');
    }
    if (this.containerNode) 
      dojo.style(this.containerNode, 'display', show ? 'block' : 'none');
    
    if (this.rootLayerTOC.toc.style == 'standard' && this.iconNode && this.checkNode) {
      dojo.place(this.iconNode, this.checkNode.domNode || this.checkNode, 'before');
    }
   
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		08-05-2013
	
		
		05:51 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                1426
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    An issue I see with legend symbology in AGS JS TOC is it does not work in IE for secured services.  We a service on ArcGIS Server 10.0 coming in to the JS API 3.3 viewer with newest AGS JS TOC widget code and see this. I called ESRI, they know about it, it has a NIM. It's something about how IE can't get bitmaps as pieces of text or something obscure, I forget.  But it works in all other browsers.  Just wondering if anyone found a way around this IE bug?   Perhaps it will work if we put the service on Server 10.1 with the legend features?  Although we'll be on 10.0 for a while.     Nianwei thank you again, your code and the documentation are great.  I would love to see ESRI officially include your AGS JS TOC widget into the API!!  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		06-14-2013
	
		
		09:27 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                852
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							     So you have to display the OBJECTID?  I have it checked off in my MXD but it still displays in the Identify results window.  Do you know how I can turn it off so it doesn't display in the identify results?  Other than specifying only the fields I don want in the IdentifyParameters (I'm using "${*}" to return all the fields).    Thanks      Yes, it would be nice to have a programmatic way of doing what you and I want to do, from the API: display all fields except for one, or a few, particular fields. So far, it seems the only way is to check them off in MXD. I will test this on our site later. For now we wanted ObjectID left there. But turning other fields off in MXD worked fine, they did not display in the infoWindows once they were turned off in MXD. But it would be nice to be able to do this from Javascript. For example, perhaps the programmer does (readily) not have access to the server and MXD/.msd. Perhaps there is a way to do this, I do not know.  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-14-2013
	
		
		07:09 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                727
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    I tried both ways and they did not work, but I figured it out with a way similar to  Jian's ...    Here:     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
        <!-- // The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices -->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
        <!-- // include a title for the window tab name -->
    <title>Multiple Service Layer Identify Popup InfoWindow</title>
        <!-- // define the location of the JavaScript API version 3.1 -->
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dijit/themes/soria/soria.css">
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/esri/dijit/css/Popup.css">    
<style type="text/css">
      html,
      body { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
    <script type="text/javascript">        
    var djConfig = { parseOnLoad: true };
    </script>   
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1"></script>
    <script type="text/javascript" language="Javascript">
        dojo.require("esri.map");
        dojo.require("esri.dijit.Measurement");
        dojo.require("dijit.layout.BorderContainer");
        dojo.require("dijit.layout.ContentPane");
        dojo.require("esri.dijit.Popup");
        dojo.require("dojo.DeferredList");
        dojo.require("esri.arcgis.utils");        
        dojo.require("esri.layers.FeatureLayer");
    var identifyParams;
    var tasks;
    var clickPoint;
 var connection;
 var checked;
var map;
    function init() {
        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"));
        var initialExtent = new esri.geometry.Extent({"xmin":-9549173.347091435,"ymin":4614123.468713058,"xmax":-9546388.17287322,"ymax":4615432.452822477,"spatialReference":{"wkid":102100}});
        map = new esri.Map("map", {  extent: initialExtent, infoWindow: popup }); dojo.place(popup.domNode, map.root);
          dojo.connect(map,'onLoad',function(){
              //setup generic identify parameters 
              identifyParams = new esri.tasks.IdentifyParameters();
              identifyParams.tolerance = 10;
              identifyParams.returnGeometry = true;
              identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
            
    dojo.connect(map,'onClick',doIdentify);
    
            });
         var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");                
        map.addLayer(basemap);
        var dynlayer1 = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyFeedSample/MapServer",{opacity:.50});
        var dynlayer2 = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyHazardsandRisks/MapServer",{opacity:.50});
        var dynlayer3 = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer");
       var measurement = new esri.dijit.Measurement({
            map: map
          }, dojo.byId('measurementDiv'));
          measurement.startup();
   
   
   dojo.connect(measurement.area, "onClick", function(){
     //change the value as you click on the tool
  if (this.checked) {
      checked=true;
     } 
else  
 checked=false;
  
   });
   
   
    dojo.connect(measurement.distance, "onClick", function(){
     
  if (this.checked) {
      checked=true;
     } 
else  
 checked=false;
  
   });
      
   
   
       dojo.connect(map,'onLayersAddResult', setupIdentify);
       map.addLayers([dynlayer3,dynlayer2,dynlayer1]);
  }
  function setupIdentify(results){
    //loop through operational layers and add identify task for each. 
    tasks = dojo.map(results,function(result){
        return new esri.tasks.IdentifyTask(result.layer.url);
    });
  }
  function doIdentify(evt){
  // only do the identify when the tool is not used
  if (checked!=true)
      {
   map.infoWindow.hide();
        clickPoint = evt.mapPoint;
        identifyParams.geometry = evt.mapPoint;
        identifyParams.mapExtent = map.extent;
        identifyParams.width  = map.width;
        identifyParams.height = map.height;
      var deferreds = dojo.map(tasks,function(task){
        return task.execute(identifyParams);
      });
      var dlist = new dojo.DeferredList(deferreds);
      dlist.then(handleQueryResults);
}
  }
  function handleQueryResults(results){
    var features = [];
    dojo.forEach(results,function(result){
      // for a simplified test let's just display all the attributes in the popup 
      if(result[1].length > 0){
        dojo.forEach(result[1],function(r){
          var feature = r.feature;
          console.log(feature);
          feature.attributes.layerName =r.layerName;
           var infoTemplate = new esri.InfoTemplate('Attributes', "${*}");
          feature.setInfoTemplate(infoTemplate);
          features.push(feature);
        });
      }
    });
    map.infoWindow.setFeatures(features);
    map.infoWindow.show(clickPoint);
  }
        dojo.addOnLoad(init);
    </script>
</head>
<body class="soria">
    <div id="mainWindow" dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width:100%; height:100%;">
      <div id="map" class="shadow" dojotype="dijit.layout.ContentPane" region="center" >
            <div style="position:absolute; right:20px; top:10px; z-Index:999;">
          <div id="titlePane" data-dojo-type="dijit.TitlePane" data-dojo-props="title:'Measurement', closable:'false', open:'false'">
            <div id="measurementDiv"></div>
            <span style="font-size:smaller;padding:5px 5px;">Press <b>CTRL</b> to enable snapping.</span>
          </div>
        </div>
      </div>      
      </div>
    </div>
  </body>
</html>
    
    
    
    
    
    
    
    
    
    
    
    
         Thanks to Rui from ESRI Support for help with this also.    Note that I had to have measurement be at the bottom of our production code. I've seen this before. Weird errors can happen when the measurement dijit instantatiation code for the measurement object is above code for certain other widgets. Hope this gets fixed eventually as it is a confusing issue as the errors don't really lead you to this conclusion and it is not documented as something that needs to be done in the API.  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-10-2013
	
		
		10:17 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                1331
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    Adrian thanks, this is awesome! I'll play around with it..  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-10-2013
	
		
		04:45 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                727
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    I have seen this too. I believe as posted above it relates to page size and using 100%.  I noticed certain browsers open a border container pane wider or narrower which affects the size of the 'map' object in the center border container pane, at least if it has a splitter and is set to percentage as mine is. It seems slightly differently sized in each browser, I will check this some point soon and report back...    It is unfortunate, I wish there were a solution. What it basically means is you're never sure the EXACT extent if you have users with differing monitor resolutions and browsers.  I am going to have to just explain that to end users. They wanted the "same" zoom and extent for all situations and when you have tiles it doesn't seem possible, it jumps a bit to one direction based on size of the map. Only way would be to lock down the size of the viewport of the bordercontainer pane containing the 'map' object, that I can think of..  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-09-2013
	
		
		09:25 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                2206
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    Thank you both, I see what these do conceptually. Unfortunately I tried both ways, neither work in 3.3.    So, for my site I'd used sample code here to use Identify Task on my layer where it loops through and identifies everything. http://jsfiddle.net/URpaW/ Also I called my measurement object 'measurement' as you all did above.    It pops up always, after clicking measurement tools.    First I tried M. Knapp's method of disabling mouse events. While console messages fired, it didn't work. I checked the API Reference and noticed there isn't even a enableMouseEvents or disableMouseEvents  in map.graphics! Or perhaps it is there but I did not see it. The API page needs a more robust Search.    I then tried Jian's idea -- disabling the handler (doIdentify  for onClick of map  which stores the Identify logic). Also added connect to put it back after Measurement was stopped.     I got a message saying Dojo.js did not support removing the object. Console messages again fired successfully but this did not work either. 😕    Thoughts?    I will continue working on this and update...  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-09-2013
	
		
		08:02 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                1332
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    Dan thank you for your reply.    I figured it out -- we needed to add a proxy. We added a proxy and put the token in there. We generated the token from the generator page. Now it works.  Although in theory I guess your approach -should- work... Of course, storing a long token in the proxy is not the best approach, but it works for now.     Also the legend icons do not load in AGS JS TOC widget but there is already a thread about that... a couple years old! http://forums.arcgis.com/threads/38631-Legend-doesn-t-work-with-secure-map-services?p=296201#post296201    And thank you for the advise and I have heard that elsewhere -- that security is both better and more simplified for deployment in 10.1. We will look in to this.  And 10.2...  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-08-2013
	
		
		04:07 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                1573
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    I am also experiencing the same issue! We are on API 3.3.  We just secured a service with a token and put it in the proxy page. We used the token generator page to get the token. Now the secured service works fine.     But the legend symbology images come up as "x"'s in AGS JS TOC.     The legend itself loads fine, I sent the legend object to its own Accordion pane. But the legend symbology icons are X's in the AGS JS TOC widget. Which is more important. (Still not sure why they don't just include AGS JS TOC in API?)    --update--  I called ESRI and it is apparently a bug related to IE only. Something regarding "base 64 rasters" or something equally specific, and which all browsers support but IE. He said it's NIM065326: Legend widget does not honor proxy when requesting swatches. http://support.esri.com/en/bugs/nimbus/TklNMDY1MzI2    And to use this workaround: put this into the code:     dojo.connect(map, 'onExtentChange', onZoomEnd);
function onZoomEnd() {
        if (navigator.appName == 'Microsoft Internet Explorer') {
                timer = setTimeout(function () {
                                var imgs = dojo.query('.esrilegendLayer > tbody > tr > td > img');
                                for (var i = 0; i < imgs.length; i++) {
                                        imgs.src = "http://server/proxy.ashx?" + imgs.src;
                                }
                        }, 100);
        }
}         However the symbols DO load fine in my Legend dijit, just not AGS JS TOC, in IE (only in IE).      Nianwei Liu  or anyone familiar with the inner workings of the AGS JS TOC do you know?    Anyone else have any luck?  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-08-2013
	
		
		04:04 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                1
             
         | 
        
             
                
                    
                
                1882
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    dbecker88 if I may ask you or others:    I'm trying for the first time to set up security. We have one service we want to use with tokens. Just http for now. (https later). We set up SQL database with some users and roles and enabled anonymous user roles.    I turned it to http following the docs - http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#/Setting_up_users_and_roles_in_SQL_Server/0093000000q0000000/     <Web server root>\ArcGIS\Tokens\web.config and other two files updated fine. Note.. there was no space in the second key line, make sure to check spaces pasting in the AppSettings keys!    We turned on the token service. I can get to our token service page fine with http://ourserver/tokens/gettoken.html    That generates a token fine.     However in our site and on the sample Sandbox (http://developers.arcgis.com/en/javascript/sandbox/sandbox.html?sample=widget_identitymanager_client_side)    ... the user / role we created for this Service fails.    I included Identity Manager and the local storage stuff from the sample (we want local storage for now, maybe proxy later..)    It pops up as it should, asks for credentials. But when I enter the user /pass it says "Unable to access the authentication service.  "    However... when I turn the service Permissions in ArcGIS Server Manager to "Everyone" it works just fine!     Interestingly though I noticed this secure service half-works on ArcGIS.com. I spied on it in F12/Firebug network connections and saw it got a token (the token at the end of the URL).  However popups do not work. Even with everyone access. But that is fine, popups work with Everyone access in our site. It's only when we lock it down to the secured User that it fails, "Unable to access the authentication service."    Anyone seen this?    Called tech support, we couldn't fix it, we tried making a new user, new service/.msd, etc. Still happens. In fact I took the sample, but just stuck my secured service in it, same error. As both FeatureLayer and Dynamic. Will keep working on it, post results back...  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-07-2013
	
		
		11:55 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                1573
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    FYI -- I tried this in Firefox 20 and I see it, too.  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-07-2013
	
		
		11:41 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                519
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							     Glad you got it working.  The API documentation for FeatureLayer needs some work to say the least.  I just got there by trial and error my self.  You'l see in the sample they add the layer twice as well.      Does this affect the AGS JS TOC, and list it twice there? If so and that is indeed how it's designed as of now in the API, that would be important to fix in API 3.5+. Many of us here use AGS JS TOC! :cool:    For my current site I am using Identify from the Sample code which seems to have this built in. But on our other site I added everything as feature layers, in 3.3, and used Query Task with search radius. Added each only once. I was also surprised no paging was there. Wasn't sure why and this was on a research to do list.. Thank you to everyone that posted here! I will also try this workaround eventually for our other site, post whether it works for us!  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-07-2013
	
		
		11:37 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                1370
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    And if it's OK I'll jump on this bandwagon -- anyone using server-side authentication with ESRI secured REST services, via ASP.NET, and have it up as a site we could check out?    So, instead of a second popup for credentials it just uses the ones you already provide if you log in to the standard Windows Forms ASP.NET site (with the Log In on Site.Master and SQL Server database backend functionality). We have API 3.4 with Arc 10.0 Sp5 secured REST service now. We are testing with Identity Manager but it'd be nice to piggyback on the built-in ASP.NET authentication mechanism. I guess in referring to this http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/ags_secureservices.html it may (does?) involve a proxy page? Haven't played with those, we've attempted to stay away from it until we really need it. If we figure this out we'll post back here, too.  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-06-2013
	
		
		06:34 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                715
             
         | 
    
| 
             
                POST		  
                
             
         | 
        
        
 
					
							    Thank drhall001 and others. I will test your solution. However, is this still a workaround for an existing bug?    I don't understand why "LAYER_OPTION_VISIBLE " shouldn't work. Even with scale dependencies. However on my site it's not working, all layers show in popups. Here is the scenario: We have a simple site, and it calls one rest endpoint with around 100 layers in several groups and subgroups, bringing them in as one dynamic layer. I'm using the AGS JS TOC widget, to present it.  (Love that thing! )    I'm using the Identify task for popups. There are several scale categories for scale dependency I set in the MXD so certain layers would appear at one scale, more at another, and finally all, at the lowest zoom scale dependency.    LAYER_OPTION_VISIBLE  does nothing. Identify just presents popups for everything. At all scales.  I also tried using identifyParams.layerIds = LAYERNAME.visibleLayers   ... still no luck.    Based on the API docs for LAYER_OPTION_VISIBLE ... shouldn't this just work? So is this a known API 'bug'?  Or is this related to AGS JS TOC?    Thank you to everyone here! I will test the solution above soon this week or next and report back results.  
						
					
					... View more
				 
			
			
			
			
				
			
			
			
			
			
			
		
			
    
	
		
		
		05-01-2013
	
		
		11:38 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		          | 
        
             
                
                0
             
         | 
        
             
                
                0
             
         | 
        
             
                
                    
                
                497
             
         | 
    
| Title | Kudos | Posted | 
|---|---|---|
| 23 | 12-16-2014 10:46 AM | |
| 2 | 06-06-2014 06:45 AM | |
| 1 | 12-15-2014 01:07 PM | |
| 1 | 07-14-2014 01:18 PM | |
| 1 | 07-15-2014 05:37 AM | 
| Online Status | 
					
			 
	
			
					Offline
				
		
 
		
				 | 
			
| Date Last Visited | 
					
			 
				
    
	
		
		
		11-11-2020
	
		
		02:23 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
			 
		
				 |