pramodharithsa

Infowindow-Feature is un-identified

Discussion created by pramodharithsa on Jun 14, 2012
Latest reply on Jun 17, 2012 by pramodharithsa
This is my code to show feature attributes using infowindow,
(I have used the same code as http://help.arcgis.com/en/webapi/javascript/arcgis/demos/query/query_showinfowindow.html except for including my own dynamic layer(with a polyline geometry))
var dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://asdfgh258069d/ArcGIS/rest/services/t234/MapServer");
            map.addLayer(dynamicLayer);

            //Listen for click event on the map, when the user clicks on the map call executeQueryTask function.
            dojo.connect(map, "onClick", executeQueryTask);

            //Listent for infoWindow onHide event
            dojo.connect(map.infoWindow, "onHide", function () { map.graphics.clear(); });


            //build query task 
            queryTask = new esri.tasks.QueryTask("http://asdfgh258069d/ArcGIS/rest/services/t234/MapServer/5");

            //Can listen for onComplete event to process results or can use the callback option in the queryTask.execute method.
            //dojo.connect(queryTask, "onComplete", showResults);

            //build query filter
            query = new esri.tasks.Query();
            query.outSpatialReference = { "wkid": 102100 };
            query.returnGeometry = true;
            query.outFields = ["CMDY_DES","COUNTRY","STATE","OWNER","DIA_IN","Risk_Score"];


        }

        function executeQueryTask(evt) {
            map.infoWindow.hide();
            map.graphics.clear();
            featureSet = null;

            //onClick event returns the evt point where the user clicked on the map.
            //This is contains the mapPoint (esri.geometry.point) and the screenPoint (pixel xy where the user clicked).
            //set query geometry = to evt.mapPoint Geometry
            query.geometry = evt.mapPoint;

            //Execute task and call showResults on completion
            queryTask.execute(query, function (fset) {
                if (fset.features.length === 1) {
                    showFeature(fset.features[0], evt);
                } else if (fset.features.length !== 0) {
                    showFeatureSet(fset, evt);
                }
            });

no features are identified onclick
fset.features.length returns 0.

With the same layer Identify params works fine!
 identifyParams.geometry = evt.mapPoint;
            identifyParams.mapExtent = map.extent;

            var deferred = identifyTask.execute(identifyParams);

            deferred.addCallback(function (response) {
                // response is an array of identify result objects     
                // Let's return an array of features.
                return dojo.map(response, function (result) {
                    var feature = result.feature;


What am i missing?

Outcomes