bg3075

How can I point popup to my own featureLayer?

Discussion created by bg3075 on Aug 2, 2012
Latest reply on Aug 6, 2012 by bg3075
I am new to using the Javascript API, and trying to add the sample popup info window to my web application. What I found to easiest is to first add my dynamic data source to the sample code first until I get it to function properly, and changing the initial extent to my map area, and then try to migrate the sample tool to my web application. In the "Popup" sample (above link), I was able to change the initial extent, and add my own data as the new esri.layers.FeatureLayer link. This all functions properly. As is, I even get a popup when selecting my data (polygons) and able to use the "Zoom to" function in the popup window, but cannot figure out how to change the sample source data to display my attribute data in the popup window. Everything I have tried did not work, basically modifying this portion of code:
function getTextContent(graphic) { 
        var attr = graphic.attributes.qSpecies.replace('"',"").split("::"); 
        var content; 
        var scientificName = attr[0]; 
        //display the common name if it exists - otherwise just the scientific 
        if(attr[1]){ 
          content = "<b>" + dojo.string.trim(attr[1].replace('"',"")) + "</b><br/><i>" + scientificName + "</i>"; 
        } 
        else{ 
          content = "<i>" + scientificName + "</i>" 
        } 
        return  content + "<br>" + graphic.attributes.qAddress
      } 
       
     function pointToExtent(map, point, toleranceInPixel) { 
       var pixelWidth = map.extent.getWidth() / map.width; 
       var toleraceInMapCoords = toleranceInPixel * pixelWidth; 
       return new esri.geometry.Extent( point.x - toleraceInMapCoords, 
                    point.y - toleraceInMapCoords, 
                    point.x + toleraceInMapCoords, 
                    point.y + toleraceInMapCoords, 
                    map.spatialReference );                            
      } 
Can anyone help, maybe simply by letting me know how to generally connect a featureLayer data source to a popup? Sorry, but I cannot display my own code here due to the nature of our business.

Outcomes