AttributeInspector doesn't show any field!

625
0
12-12-2011 09:15 AM
TiagoRibeiro
Occasional Contributor
Can someone please help me!
I'm trying to use AttributeInspector to show the contents of a Feature layer. My reference is this sample http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/ed_attribute_inspector.html, but I want to be able to browse the data without necessarily see it on the map. I think I managed but for some reason the AttributeInspector doesn't show the fields, just delete button, and the navigation buttons (so I supose that its getting the data). Can someone please help me? Here's my code. The AttributeInspector starts when you call the function queryProcess() from the console. Its this way for testing proposes.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 <title>Tests</title>
 <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/claro/claro.css">
 <script src="/arcgis_js_api/library/2.5/arcgis/" type="text/javascript"></script>
    <script type="text/javascript">
      djConfig = {
        parseOnLoad: true
      };
    </script>
  <style type="text/css">
      .esriAttributeInspector {height:100px;}
      .esriAttributeInspector .atiLayerName {display:none;}
      .saveButton {
        padding-left:45px;
         margin:0px;width:16px; height:16px;
       }
    </style>

 <script type="text/javascript">
  dojo.require("esri.map");
  dojo.require("esri.layers.FeatureLayer");
  dojo.require("esri.dijit.AttributeInspector-all");
  
  var initialExtent = new esri.geometry.Extent({"xmin":-1051697,"ymin":4386071,"xmax":-776524,"ymax":4569520,"spatialReference":{"wkid":102100}});
  var baseMap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",{id:"basemap"});
  var sessaoBase = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost/ArcGIS_Server/rest/services/ARH_BASE/MapServer",{id:"sessaobase"});
  var featureLayer;
  var map;
  
  var processosId;
  function init() {
   //criar mapa
   map = new esri.Map("map",{extent:initialExtent, logo:false});
   
   //criar a featurelayer   
   featureLayer = new esri.layers.FeatureLayer("http://localhost/ArcGIS_Server/rest/services/ARH_PROCESSOS/FeatureServer/1",{
            mode: esri.layers.FeatureLayer.MODE_SELECTION
    ,outFields: ["*"]
         });
   
   var attInspector = new esri.dijit.AttributeInspector({layerInfos:[{'featureLayer':featureLayer}]}, "attrInspector");
   
   //adicionar layers ao mapa
   map.addLayers([baseMap,sessaoBase]);
  }
  
  function queryProcess(){
   var query = new esri.tasks.Query();
   query.where = "ObjectID > 1";
   featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function(features){
    console.log(features);
   });
  }
  dojo.addOnLoad(init);
 </script>
</head>
<body class="claro">
  <div id="map" style="float: left; width: 50%; height:400px; border-top:1px solid black; border-bottom:1px solid black; border-right:1px solid black;"></div>
  <div id="teste" style="float: right; width: 50%; height:400px; border-top:1px solid black; border-bottom:1px solid black;">
   <div id="attrInspector"></div>
  </div>
</body>
</html>
0 Kudos
0 Replies