whileyryan

Displaying information in sidebar based on a selection

Discussion created by whileyryan on Jun 27, 2013
Hello

I am currently trying to display information in my sidebar based on a selection I make on the map.  There are four fields that I want displayed but none of them are appearing, all the appears is a statement saying "No Features Selected."  It looks fine up until I click a location, and then the information does not arrive.  So I'm guessing that it is related to the onClick demand.  Either that or maybe it is related to the "innerHTML' ';" towards the bottom of the code, but I just don't know.  I've gone through and tried several different things that I thought could maybe work, but none did.  Here is the relevant code.
function init() {
esri.config.defaults.io.proxyUrl = "/proxy.jsp";
map = new esri.Map("map", {
  basemap: "topo",
  center: [-68.95921478269354, 12.201009750494986],
  zoom:11,
  
  });
  var popup = new esri.dijit.Popup(null, dojo.create("div"));
  
var censusMapLayer = new esri.layers.ArcGISDynamicMapServiceLayer("ihavetherightlink/rest/services/MapServer");
        map.addLayer(censusMapLayer);

operationalLayer = new esri.layers.FeatureLayer("ihavetherightlink/rest/services/FeatureServer/0", {
        mode     :esri.layers.FeatureLayer.MODE_ONDEMAND,
        outFields:["Adres", "Buurten", "B_STATUS", "FUNCTIE"]
      });

operationalLayer.setSelectionSymbol(new esri.symbol.SimpleFillSymbol());

  
createBasemapGallery();

        //create find task with url to map service
        findTask = new esri.tasks.FindTask("ihavetherightlink/rest/services/MapServer");

        //create find parameters and define known values
        findParams = new esri.tasks.FindParameters();
        findParams.returnGeometry = true;
        findParams.layerIds = [0];
        findParams.searchFields = ["Adres", "Straatnaam_conc", "FUNCTIE", "B_STATUS"];
  
  dojo.connect(map, 'onLoad', function(map) {
          //resize the map when the browser resizes
          dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
        });
  
  dojo.connect(dijit.byId("mapPanel"), "resize", function(changeSize, resultSize){
     map.resize();
    });
    
  dojo.connect(map, 'onLayersAddResult', function (results) {
        //add the legend
        

        var layerInfos = [
          {
            'featureLayer'    :operationalLayer,
            'showAttachments' :true,
            'isEditable'      :true,
            'showDeleteButton':true,
            'fieldInfos'      :[
              {'fieldName':'Adres', 'tooltip':'Adres', 'label':'Adres:', 'isEditable':true},
              {'fieldName':'Buurten', 'tooltip':'Idk', 'label':'Buurten', 'isEditable':false},
              {'fieldName':'B_STATUS', 'label':'Status', 'isEditable':false},
              {'fieldName':'FUNCTIE', 'label':'Functie', 'isEditable':true}
            ]
          }
        ];

        var attInspector = new esri.dijit.AttributeInspector({
          layerInfos:layerInfos
        }, "attributesDiv");
      });

      var selectQuery = new esri.tasks.Query();

      dojo.connect(map, "onClick", function (evt) {
        dojo.byId('details').innerHTML = ' ';
        selectQuery.geometry = evt.mapPoint;
        operationalLayer.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, null);
      });

      map.addLayers([operationalLayer]);
    
}


I tried to work with [url=https://developers.arcgis.com/en/javascript/jssamples/popup_sidepanel.html]This sample[/url] but I have no mapID so I didn't think I would be able to do it with this code.  So I tried the above code and feel like I'm getting close.

Any hints you can give me would be greatly appreciated.

Thanks!
Ryan

Outcomes