Multiple layers in attribute inspector

789
0
04-14-2014 01:44 PM
williamcarr
Occasional Contributor II
Hey guys,

This is a really easy one, but I'm negligent when it comes to syntax. I'm trying to do a basic attribute inspector with multiple layers.
             function initSelectToolbar(evt) {
              
              
              
              
              
              
              
              
          var petroFieldsFL = evt.layers[0].layer;
       
          var selectQuery = new Query();

          map.on("click", function(evt) {
            selectQuery.geometry = evt.mapPoint;
               
            /** TM Calculating tolerance for point **/
            var centerPoint = new esri.geometry.Point
                (evt.mapPoint.x,evt.mapPoint.y,evt.mapPoint.spatialReference);
            var mapWidth = map.extent.getWidth();
 
            //Divide width in map units by width in pixels
            var pixelWidth = mapWidth/map.width;
 
            //Calculate a 10 pixel envelope width (5 pixel tolerance on each side)
            var tolerance = 10 * pixelWidth;
 
            var x = evt.mapPoint.x;
            var y = evt.mapPoint.y;
          
            //Build tolerance envelope and set it as the query geometry
            var queryExtent = new esri.geometry.Extent
            (x-tolerance, y-tolerance,x+tolerance,y+tolerance,evt.mapPoint.spatialReference);
           
            selectQuery.geometry = queryExtent;
            petroFieldsFL.selectFeatures(selectQuery, FeatureLayer.SELECTION_NEW, function(features) {
            
               //store the current feature
                updateFeature = features[0];
                map.infoWindow.setTitle(features[0].getLayer().name);
                map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
             
            });
          });

          map.infoWindow.on("hide", function() {
            petroFieldsFL.clearSelection();
          });

          var layerInfos = [{
            'featureLayer': petroFieldsFL,
            'showAttachments': false,
            'isEditable': true,
            'fieldInfos': [
              {'fieldName': 'SERVICE_ID', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'FIRSTNAME', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'LAST_NAME', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'CITYSTATE', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'ZIPCODE', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'TOWNSHIP', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'COUNTY', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'LOCATION', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'PHONE', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'METERLOCATION2', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'AMR', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'SHEET', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'},
              {'fieldName': 'PHASE_1', 'isEditable':false, 'tooltip': 'Current Status', 'label':'Status:'}
           
          
            ]
            
            
            
            
            
          },
          
            {
            'featureLayer': petroFieldsFL1,
            'showAttachments': false,
            'isEditable': true,
            'fieldInfos': ["*"]
          }
          
          ];
        
       
          

          var attInspector = new AttributeInspector({
            layerInfos:layerInfos
      
          },
          

I've tried many variations but it always comes up with one layer or the other or neither. Changing the fieldInfos to "*" seemed to have that effect. Any ideas as to the location of my bludering?
0 Kudos
0 Replies